le_spi_WriteHD() doesn't work right for SPI with 24 bits per word

Hi,

I’ve created a small SPI test program which runs on my mangOH Green board with a WP76xx controller.
fwupdate query returns:
Firmware Version: SWI9X07Y_02.18.05.00 000000 jenkins 2018/07/19 17:40:21
Bootloader Version: SWI9X07Y_02.18.05.00 000000 jenkins 2018/07/19 17:40:21
Linux Version: 3.18.44 #2 PREEMPT Thu Sep 20 16:20:02 UTC 2018

My mangOH system and testapplication have been built with the most recent Sierra Wireless firmware release package R10.1.1 (Legato 18.06.3).

The testapplication uses spidev1.0 and configures the SPI bus with
le_spi_Configure(spiHandle, 3, 24, 960000, 0);

I try to use API function le_spi_WriteHD( handle, writeDataPtr, writeDataSize) to put 24 bit data-words on the SPI bus.
So, basically you need a pointer to an array of uint8_t, and a datalength as parameters.
I assumed that a 24 bit data-word would need an arraylength which is a multiple of 3 :slight_smile:
Apparently, the API function returns an error in that case.

My testapplication tries to call le_spi_WriteHD() with several lengths.
The data array contains a list of byte values 0x0F.

  • length = 3 ==> error
  • length = 4 ==> LE_OK, but, I get two 24 bit data-words on the bus
  • length = 6 ==> error
  • length = 8 ==> LE_OK, but, I get three 24 bit data-words on the bus
  • length = 9 ==> error

In attachment, you can find:

  • testapplication sources
  • application log-file (spiService.adef contains LE_LOG_LEVEL = DEBUG)
  • screenshots from the oscilloscope

In the screenshots you can see that the SPI bus contains 24 bit data-words.
For an array length of 4, the data-words are 0x0F0F0F and 0x00000F
For an array length of 8, the data-words are 0x0F0F0F, 0x0F0F0F and 0x000F0F

Why does the API function le_spi_WriteHD() only work with arrays of 4 or 8 bytes? (related to uint32_t handling in Legato drivers?)
Why does this fail for arrays of 3 bytes, which is needed to create a 24 bit data-word?

spitest - log.txt (3.5 KB)
test.tar.gz (1.9 KB)

SPI%2024bits%20per%20word%20-%20overview
SPI%2024bits%20per%20word%20-%20detailed%20view
SPI%2024bits%20per%20word%20-%20use%204%20data%20bytes
SPI%2024bits%20per%20word%20-%20use%208%20data%20bytes

Greetings,
annaertd