STM32F7 (H7). FMC. DSB command for external Nor-Flash memory

Discussion in 'Embedded Systems and Microcontrollers' started by NikoDo, Sep 10, 2018.

  1. NikoDo

    Thread Starter New Member

    Sep 10, 2018
    1
    0
    Good afternoon, dear collegs!

    I'v started to connect STM32H7 (Cortex M7) MCU with exteranal Nor-Flash memory by use FMC. I'm alittle confused by write command. Without DSB() command it refuses to work correct. Program loads from embedded Flash (7 waitstaits).

    Doesn't work (C):
    Code (Text):
    1. *(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__);
    (Asm):
    Code (Text):
    1. MOVS r0,#0xF0
    2. STRH r0,[r4,#0xAAA]
    3. (next instuction)
    4. ...
    Work correct (C):
    Code (Text):
    1. *(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__);
    2. __DSB();
    (Asm):
    Code (Text):
    1. MOVS r0,#0xF0
    2. STRH r0,[r4,#0xAAA]
    3. NOP
    4. NOP
    5. NOP
    6. DSB.W
    7. NOP
    8. NOP
    9. NOP
    10. NOP
    11. (next instuction)
    12. ...

    Can anyboady explain me why it work so? Why we need to wait execution of all previous instructions before storing new data in new address? On STM32F4 (Cortex-M4) it works without DSB command.

    What time (CPU cycles) does instruction STR takes? RM of ARM v7 gives 2 N-cyles. But what does it means in CPU cylces I don't understand.



    I'll be glad to any help!
     
Loading...