A few generic questions regarding DMA from flash memory to LCD on ATSAML21e18b

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

This is my inspiration (https://www.youtube.com/watch?v=...)

 

I am reading the data sheet regarding getting DMA working and trying to wrap my head around what I need to do and I have some generic questions.

 

I have an LCD screen that is currently using SPI to read some BMP data from a flash memory - however I am unsatisfied with the speed at which this is accomplished. I can visibly see the image load from bottom to top - I would like for it to load faster than the human eye can perceive so as to give the illusion of an image popping up immediately. The MCU isn't really doing much work but it seems that sending and receiving the data is a bit on the slow side between the flash memory and the LCD:

 

for (int row = (int)header.imageHeight-1; row >= 0; row--) {
        for (int k=0; k<(bytesPerRow/2); k++){ //get next row from flash
            pixelBuffer[k] = read16Bit(currAddress, rx, rx);
        }
        for(uint16_t col = 0; col<header.imageWidth; col++){
            /*convert each color from RBG565 to BGR565*/
            uint16_t color = pixelBuffer[col];
            uint16_t tmp = (color & 0x001F) << 11;
            tmp |= (color & 0xF800) >> 11;
            color &= 0xFFE0 & 0x07FF;
            color |= tmp;
            TFT_SetPixel(Xoffset+col,Yoffset+row,color); //draw pixel
        }

 

The first loop goes through every row of the image, the first nested loops gets a row of pixel data and the second nested loop manipulated the color scheme and sends the color information for each pixel to the LCD. Both the flash memory and the LCD and connected to their own respective SPI. 

 

The MCU is, as mentioned, an ATSAML21E18B. The LCD screen is an ILI9341 and the flash is SST26VF016B.

 

Does anyone else have a gut feeling of how I could get this done as fast as possible so that the images load quickly?

1010001010111101110111

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You will at least need something better than TFT_SetPixel, build and transfer at least a full row of pixels. If there is no function in the TFT API for that you will have to make one.

There may be similar problems with read16Bit, is there no way to read more (like a full row) from the flash in one go?

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Lars,

 

There is a function to send a horizontal line but it seems to also just be using a loop that uses the same command for the LCD:

 

TFT_SendCMD(0x2c);
	
for(i=0; i<length; i++)
   TFT_SendData(~color);

 

As for the read16Bit, that's something that I can change as I wish on the go as I programmed the flash driver on my own. It reads 16 bits because each pixel is 2 bytes worth of data but it is stored lsB first in the BMP format, so the read16Bit function has to do a bit shift and then return msB+lsB, however that could all be pulled out of the read function. I could simply read an entire row of data, do some work on it, send it to the LCD while reading the next row. The question is how to get DMA activated in this MCU. ASF seems to be riddled with bugs and these forums seem to be full of unanswered questions regarding DMA on these MCUs. 

1010001010111101110111