Why is my SPI slave only sending one byte?
I am trying to read the position of an absolute rotary encoder (AMT22B-V). I have it connected to a Nucleo G474RE board. In the main.h file of the STM32CubeIDE project, I have the following declaration:
#define BUFFERSIZE (COUNTOF(aTxBuffer) - 1)
In the main.c file, I have the following code:
uint8_t aTxBuffer[] = {0x00, 0x00};
uint8_t aRxBuffer[BUFFERSIZE];
HAL_SPI_TransmitReceive(&hspi1, (uint8_t *)aTxBuffer, (uint8_t *)aRxBuffer, BUFFERSIZE, 5000);
I am transmitting the 0x00 0x00 read command on MOSI and hoping to receive 2 bytes on MISO that describe the position of the encoder. However when I probe the lines with the logic analyzer function of my oscilloscope, I see that as I turn the encoder, only one byte is changing; the other one isn't changing. See image below. Also, I have the SPI data size set to 16 bits. I have a feeling that the issue has something to do with the BUFFERSIZE parameter. Any help is much appreciated.

