Author Topic: ARM Cortex M7 STM3F746: external bus cache problem (solved)  (Read 2320 times)

0 Members and 1 Guest are viewing this topic.

Offline bktempTopic starter

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
ARM Cortex M7 STM3F746: external bus cache problem (solved)
« on: March 29, 2016, 06:24:49 pm »
I am trying to drive a display using 16bit bus connected to STM32F746's FMC.
I did configure the FMC for SDRAM + SRAM (both share the same data and address lines) and write the data directly to the SRAM address where the display is connected to:
Code: [Select]
volatile uint16_t * const lcd_data = (volatile uint16_t*) 0x60000000;
*lcd_data=value;
When sending a single word I can see the FMC_NWE line pulsing once, as expected. But when sending multiple words in a burst it also pulses only once.
It looks like some caching is happening somewhere, so only one write is generated despite multiple writes being requested. If I add a short pause (5us) after each write, I get the correct number of pulses and the display works, but it is much too slow.
I can rule out the data cache, because it is disabed.

Can any ARM expert give me a clue where the caching happens and how to solve this problem?
« Last Edit: March 30, 2016, 05:50:05 am by bktemp »
 
The following users thanked this post: ataradov

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: ARM Cortex M7 STM3F746: external bus cache problem
« Reply #1 on: March 29, 2016, 08:55:46 pm »
There isn't something like a bus arbiter cache in between? This used to be a problem with PCI I/O on x486 PCs as well where you'd needed to do a read after a write to flush the write cache.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Koen

  • Frequent Contributor
  • **
  • Posts: 502
Re: ARM Cortex M7 STM3F746: external bus cache problem
« Reply #2 on: March 29, 2016, 11:22:44 pm »
I had the same symptoms and adding a delay also did the trick. I've solved it by adding this :

Code: [Select]
MPU->RNR = 1;
MPU->RBAR = 0x60000000;
MPU->RASR = 0x1300002d;
MPU->CTRL = ((uint32_t) 0x00000004) | MPU_CTRL_ENABLE_Msk;
SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
I don't remember anything about it but you can try it.
 

Offline bktempTopic starter

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
Re: ARM Cortex M7 STM3F746: external bus cache problem
« Reply #3 on: March 30, 2016, 05:49:04 am »
I had the same symptoms and adding a delay also did the trick. I've solved it by adding this :

Code: [Select]
MPU->RNR = 1;
MPU->RBAR = 0x60000000;
MPU->RASR = 0x1300002d;
MPU->CTRL = ((uint32_t) 0x00000004) | MPU_CTRL_ENABLE_Msk;
SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
I don't remember anything about it but you can try it.
It works!

The only difference to my init code seems to be the TEX setting:
All examples I could find used TEX level 1 so I used setting 1, but in your code it is set to 0.

A bit more googeling revealed at least a short description (C, B bits set to 00):
TEX = 1: memory area is set to non-cacheable
TEX = 0: memory area is set to strongly ordered
That makes sense. Thanks!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf