Hello,
We are not able to establish full duplex communication for SPI.
SPI tx is working completly file but when it comes to read a register from SPI slave the write and read operation is not working for single CS operation.
We want to perform read register operation as below
<CS LOW> <REG ADDRESS MSB> <REG ADDRESS LSB> <READ_REG_BYTE 1> <READ_REG_BYTE 2> <READ_REG_BYTE 3> <READ_REG_BYTE 4> <CS HIGH>
To achieve this we have written following spi full duplex function
tx_info_temp.buf_len = 2;
rx_info_temp.buf_len = 4;
write_register_data = (uint8 *) malloc (2);
write_register_data[0] = 0x00;
write_register_data[1] = 0x08;
read_register_data = (uint8 *) malloc (4);
qapi_SPIM_Full_Duplex(hSPI, &spi_device_config, &tx_info, &rx_info_temp, spi_io_complete_cb, NULL);
//calling wait function.
The code is executing without any error messages, but when we view it on logic analyzer
MOSI 0x00 0x08 0x00 0x00
MISO 0xFF 0xFF 0xFF 0xFF
Means total 6 byte transaction should be there but only 4 bytes are seen and CS goes high after that.
Please suggest a solution for this.
Thank You,
Akshaay24
Hi Akshaay24,
What should be used between tx_info and tx_info_temp in the transaction.
It looks you're configuring tx_info_temp but using tx_info in qapi_SPIM_Full_Duplex().
Thanks
BR,
Jayden
Hi Jayden,
It was a typo error, the SPI is actually configured for tx_info_temp.
qapi_SPIM_Full_Duplex(hSPI, &spi_device_config, &tx_info_temp, &rx_info_temp, spi_io_complete_cb, NULL);
what can be the issue behind this. The actual output i should get on MISO is 0x12 0x34 0x56 0x78.
Its only receiving 2 bytes insted of 4 and that is 0xFF.
Can anyone suggest a solution for why fullduplex is not working on my silex board for QCA4020.
Thank you,
Akshaay
I have tried to set tx_buf_info to 2bytes, rx_buf_info to 4bytes and connected MOSI to MISO for verifying if the same data is received.Since your rx_length is 4, the CLK with consider maximum length of MOSI/MISO which is 4 in this case ans CS will assert after 4 bytes.
Below is my configuration:
rx_info_temp.buf_len = 4;
I am attaching MOSI/MISO/CS/CLK plot for referance :