0.7.0 SPI.transfer(...)

#include <stdint.h>

#define SPI_ENABLE A6


void setup() {
	Serial.printf("*** BEGIN ***\r\n");
	Serial.printf("  [%d]\r\n",millis());
	SPI.setClockSpeed(1, MHZ);
	digitalWrite(SPI_ENABLE, HIGH); //deselected

void loop() {

  uint8_t rx_buffer[255];
  uint8_t tx_buffer[255];
  uint8_t count = 0x57;
  for(int i = 0; i < 255; i++) {
	tx_buffer[i] = count;
	rx_buffer[i] = 0;
  digitalWrite(SPI_ENABLE, LOW);
  delayMicroseconds(50); //wait for second electron to get ready

  SPI.transfer(tx_buffer, rx_buffer, 8, NULL);
  digitalWrite(SPI_ENABLE, HIGH);

  uint64_t b15 = rx_buffer[15];
  uint64_t b14 = rx_buffer[14];
  uint64_t b13 = rx_buffer[13];
  uint64_t b12 = rx_buffer[12];
  uint64_t b11 = rx_buffer[11];
  uint64_t b10 = rx_buffer[10];
  uint64_t b9 = rx_buffer[9];
  uint64_t b8 = rx_buffer[8];
  uint64_t b7 = rx_buffer[7];
  uint64_t b6 = rx_buffer[6];
  uint64_t b5 = rx_buffer[5];
  uint64_t b4 = rx_buffer[4];
  uint64_t b3 = rx_buffer[3];
  uint64_t b2 = rx_buffer[2];
  uint64_t b1 = rx_buffer[1];
  uint64_t b0 = rx_buffer[0];

  Serial.printf("received over SPI: (hex) %x,%x,%x,%x,%x,%x,%x,%x and %x,%x,%x,%x,%x,%x,%x,%x\r\n",b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15);



I could post the sending code too, but it looks fine on the bus to me:

edit: Am I missing something by not expecting to see the zeroes in the printf here?

So, what’s the question?

Am I missing something by not expecting to see the zeroes in the printf here?

changing uint64_t to uint8_t seems to fix my issue.

mods: feel free to delete this thread

@json, for whatever reason you declared your bxx variables as uint64_t even though the array uses uint8_t types. The printf() command requires that you qualify the type of value you want to print and I am not sure if uint64_t types are supported (unsigned long long int). You could try %llx for each value to see if that works. Or, simply declare your bxx values as uint8_t types.