SPI loopback test fail


#1

Hello

I am usin gthe wp76xx in order to test API

I have fixed spi issue :
by modifying SPI address in:
apps/platformServices/spiService.adef
I have SPI up and running, I can send SPI messages using Legato and view them on osciloscope.

the issue arive when I try to read SPI, I am using the following code

le_result_t res_read;
uint8_t buffer_tx[] ={0x00, 0x00, 0x00, 0x00};
uint8_t read_result[4];
size_t read_result_size = NUM_ARRAY_MEMBERS(read_result);
res_read = le_spi_WriteReadHD(spiHandle, buffer_tx, read_result_size,read_result, &read_result_size);
LE_INFO("spi_send_recieve");
if (res_read == LE_OK)
{

    LE_INFO("le_spi_ReadHD read result: %d %d %d %d \n", read_result[0], read_result[1], read_result[2], read_result[3]);
}
else
{
    LE_INFO("le_spi_ReadHD failed with result=%s", LE_RESULT_TXT(res_read));
}    

res_read = le_spi_WriteReadFD(spiHandle, buffer_tx,read_result_size,read_result, &read_result_size);
LE_INFO("spi_send_recieve");
if (res_read == LE_OK)
{

    LE_INFO("le_spi_ReadFD read result: %d %d %d %d \n", read_result[0], read_result[1], read_result[2], read_result[3]);
}
else
{
    LE_INFO("le_spi_ReadFD failed with result=%s", LE_RESULT_TXT(res_read));
}  

I have connected MOSI to MISO and expect to read the data I am sending, but I get on log:

Dec 6 08:37:37 swi-mdm9x28 user.info Legato: INFO | ft800_spi[15845]/ft800_spiComponent T=main | ft800_spi.c spi_send_recieve() 22 | spi_send_recieve
Dec 6 08:37:37 swi-mdm9x28 user.info Legato: INFO | ft800_spi[15845]/ft800_spiComponent T=main | ft800_spi.c spi_send_recieve() 26 | le_spi_ReadHD read result: 0 0 0 0
Dec 6 08:37:37 swi-mdm9x28 user.info Legato: INFO | ft800_spi[15845]/ft800_spiComponent T=main | ft800_spi.c spi_send_recieve() 34 | spi_send_recieve
Dec 6 08:37:37 swi-mdm9x28 user.info Legato: INFO | ft800_spi[15845]/ft800_spiComponent T=main | ft800_spi.c spi_send_recieve() 38 | le_spi_ReadFD read result: 0 0 0 0

plesae advice.

I am also testing with a default Linux application, there I can see the loop back reda :slight_smile:

root@swi-mdm9x28:/data# /data/spidev_test -D /dev/spidev1.0 -s 4333333 -b 8 -X 0xbb 0xcc
spi mode: 0
bits per word: 8
max speed: 4333333 Hz (4333 KHz)
TX: bb cc RX: bb cc


#2

problem solved. if someone needs assistance in activating SPI feel free to contact me