WinCe libraries iMx6 not DWORD aligned

Hi,

When reading and writing to and from the SPI bus on a Toradex iMx6 module running WinCe the data is not aligned to DWORDs even though the doxygen generated documentation states so. When running the exact same code using Spi_ReadWrite on a T20 the data is aligned to DWORDs. For the iMX6 it’s aligned to bytes.

Can you tell us what we’re doing wrong or is this a bug?

Best regards,
KD

@KevinElaut63,
Could you please share sample code to test on our side and let you know the feedback.

Hi,

This is the code:

HANDLE   hSPI;
DWORD    dataCount    = 0;
DWORD    spiData[20]  = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};

DWORD rxBuffer[20] = {0};

hSPI = Spi_Init(L"SPI1");
if (hSPI != NULL)
{
	Spi_SetConfigInt(hSPI, L"BitsPerWord", 8, StoreVolatile);                              
	Spi_SetConfigInt(hSPI, L"BitRateHz", 10*1000*1000, StoreVolatile);			
	Spi_SetConfigInt(hSPI, L"SpiMode", 0, StoreVolatile);

	if(Spi_Open(hSPI))
	{
		dataCount = Spi_ReadWrite(hSPI, rxBuffer, spiData, 20);
	}
}

return 0;

I attached 2 screenshots of the memory output to show that the data did not show up in the receive buffer.

I just used the code from the samples that were supplied with the library.

Kind Regards,
KD

@KevinElaut63 ,

Please try “PackedMode” option for the Spi library and try your test.

There might be a difference for Tegra and IMX6 default setting. We will look that.

Please refer “Toradex_CE_Libraries.chm” file for more information.