Sending single bytes over hw SPI; 0xFF appended every other time

Hi, I am using nRF SDK 12.0.0_12f24da, with nRF52832 on pca10040 hardware, and working with the example in examples/peripheral/spi/main.c

Initially I was working on integrating a library, and found via logic analyzer that every other SPI byte output had a 0xFF appended to it. Using the debugger in keil, I could see the correct byte being input to the function, with a fixed buffer length of 1. So I decided to go back to the example, and I am simply trying to output 0x77, however, it seems that there is an additional 0xFF appended every other call to nrf_drv_spi_transfer(), even in the stock example from the SDK. The only modification I made was to change the SPI pins in sdk_config.h, and to modify the lines in the while(1) loop in main.c to statically output 0x77:

   // APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length));

   uint8_t testie = 0x77;
   APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, &testie, 1, NULL, 1));
		 

However, every other cycle through the loop, the hardware outputs 0x77FF instead of 0x77. I thought specifying the tx_buffer_length at 1 would ensure the hardware only output one byte, but this seems not to be the case. The output on the wire looks like 0x77, 0x77FF, 0x77, 0x77FF, etc etc when it should be 0x77, 0x77, 0x77, 0x77 etc etc. Any ideas as to what's going on?

Thanks

image description

Related