cancel
Showing results for 
Search instead for 
Did you mean: 

Store Framebuffer in OSPI PSRAM?

DMacD.1
Associate II

MCU: STM32L4R9ZIJ6

PSRAM: APS1604M-3SQR-SN

Display: 800x480, RGB888, 24-bit

Hi, I'd like to use the mentioned PSRAM to store the TouchGFX framebuffer using OCTOSPI in QuadSPI mode.

I have tried setting the Frame Buffer Start Address to

OCTOSPI1_BASE (0x90000000), but that does not seem to work. I only get junk data.

I have read the TouchGFX docs, LTDC datasheets, and OSPI datasheets very thoroughly, and still cannot figure it out.

Additional Q's:

  1. How does the MCU "know" an external PSRAM has been added?
  2. Should I have used FMC for this procedure instead?

Note: I am using a custom board/application. Please assume the hardware is correct for the sake of discussion.

Any help would be appreciated. If any further clarification is needed please ask. I will include an image of the LCD display image as it stands.

7 REPLIES 7

>>How does the MCU "know" an external PSRAM has been added?

You'd have BSP code initializing the clocks,pins and OSPI/OSPIM peripheral, bring-up/config memory, enable the memory-mapping.

If you don't initialize it on the MCU, it will Hard Fault

You can validate the memory works via data pattern testing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
DMacD.1
Associate II

Thank you for your response.

I've done the initializing through CubeMX with GPIO pins as such:

// octospi.c    
 
/**OCTOSPI1 GPIO Configuration
    PC11     ------> OCTOSPIM_P1_NCS
    PF8     ------> OCTOSPIM_P1_IO0
    PF6     ------> OCTOSPIM_P1_IO3
    PF7     ------> OCTOSPIM_P1_IO2
    PF10     ------> OCTOSPIM_P1_CLK
    PF9     ------> OCTOSPIM_P1_IO1
    */

Is there anything further I need to do?(Outside of the MX generated code)

I have tried the APS1604M-3SQR-SN example code on pg.57 of AN5050, but found nothing written to 0x90000000 upon inspection in the CubeIDE Memory Monitor.

I'm not familiar with your design/implementation.

If this is a custom design you'll likely have to do some validation

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

No worries. It is a custom design. I'm looking for software answers and assuming the hardware is correct. If all I need to do is setup OSPI in CubeMX then write to address 0x90000000 then that answers my question to a degree. Thank you.

It seems I'm having an issue between OSPI indirect mode and memory mapped mode. Memory mapped mode is read-only and likely works better for Flash memory, where Images and other TouchGFX things are stored. I am trying to use memory mapped mode to read the frame buffer, but since it is read only OSPI cannot "store" or write the frame buffer to the OSPI address 0x90000000.

I will try using indirect mode instead.

I'm not sure this L4+ device supports memory mapped read/write to RAM on the OctoSPI, read perhaps, write don't think so.

For DMA/LTDC operation it's going to need to be memory-mapped for those to read data.

The memory-mapped and command modes aren't exactly inter-operable.

The general expectation being that the display/frame buffer is within the internal SRAM, so that it's not constantly switching modes, and disturbing the painting of images onto the screen.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Alex - APMemory
Senior II

There are limitation with the STM32L4R... to use OPI & QSPI RAM.

This is solved with later STM32 (L5, U5, H7...)

Alex