cancel
Showing results for 
Search instead for 
Did you mean: 

F334 SPI DMA and endian issues

Manu Abraham
Senior
Posted on March 10, 2017 at 14:46

Hi,

Continuing my saga on SPI DMA, which works now.

The idea is to use it to drive a SPI LCD, an ILI9341 with DMA.

I see that I can communicate with the LCD, but all 16 bit writes are messed up due to SPI write with 16 bits and DMA.

The F334 runs in little endian mode which I verified.

The LCD needs big endian mode. Little endian mode on the LCD is not available in SPI mode. The LCD datasheet makes it quite clear.

'ENDIAN: Select Little Endian Interface bit. At Little Endian mode, the host sends LSB data first.

Note: Little Endian is valid on only 65K 8-bit and 9-bit MCU interface mode.'

I started looking for a bitrev in the peripheral, rather than the available rbit instruction, to avoid CPU intervention on the large chunks of GRAM data, which would defeat the whole point of using DMA. In this context: Is it possible to do some bit reversing for the LCD, without CPU intervention, while still using DMA ?

But given this context, I was lost how a lot of other STM32 controllers are using the LCD. Looking at other controllers, I do see that they have a DFF bit to select between 8bit and 16bit modes, which is not available on the F334. Am I right to think that the DFF bit does bit reversing. Eventually to assume that 16 bit DMA to LCD seems impossible with the F334 ?

Can someone clarify, please ?

Any suggestions ?

Thanks!

12 REPLIES 12
Posted on March 12, 2017 at 15:40

Just spotted an issue, after click on the Add comment. One extra 'spi_dma_cmd(LCD_GRAM);' in the above. caused the issue. It appears working with the flood_fill. But my first question on the RGB:666 still exists.

Posted on March 12, 2017 at 16:12

I would like to avoid the extra hardware, if possible. But anyhow, it is good to know such a solution exists. I am additionally looking at the 8 bit SPI transfers, as you mentioned previously in the thread. Wondering whether that would work with the LCD configured in RGB666 mode. If that works, it would be even better, to switch to 18bit mode from the 16bit mode.

Posted on March 12, 2017 at 17:27

The answer is in the 2010 spec...

0690X00000606YSQAY.png

For transfer 24 bit to get an 18 bits pixel done, compared to 16 bit per pixel. No LSB/MSB issue for a 3x8 bit quantity.