Problem with byte reads from QSPI flash on i.MX RT 1011?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem with byte reads from QSPI flash on i.MX RT 1011?

1,396件の閲覧回数
mjbcswitzerland
Specialist V

Hi

Can anyone explain the problem that I am seeing in this video?
https://youtu.be/M-cn4YDcPDo

A memcpy() from external SPI Flash (XiP) fails, although the same copy works on all other i.MX RT devices that I have worked with.

What is seen is that the first 2 byte copies are OK (0x60010100 and 0x60010101) but then something strange happens after the read of a byte fro 0x60010102 has been perform. The read value is seen in the register that it was read to but he processor will not continue. If I change the program counter it continues again.

I tries copying to different RAM (ITC, DTC, OCR) with identical effects.

What I found after making the video is that if I avoid reading from 0x60010102, 0x60010106 etc. it runs without this issue. Also if I set the pointer to 0x60010102 (rather than 0x60010100) at the start of the copy it immediately has the issue (again showing that byte reads from each 4th bytes (aligned at a long word boundary + 3) trigger the issue.

It is not just an issue when trying to step the code since the processor freezes at the line if run and the watchdog fires...

Is this something known. expected or a restriction in some way of reading from the SPI flash directly?

Thanks

Regards

Mark

ラベル(1)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

1,278件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hello  Mark Butcher ,

   Do you use the IAR IDE?

   Can you reproduce your problem with the NXP MIMXRT100-EVK board with a simplified project?

   Then I can try to reproduce it and check it with our internal side.

    If you can reproduce it in the NXP official board, please send me your testing project.

    Waiting for your updated information.

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

1,278件の閲覧回数
mjbcswitzerland
Specialist V

Kerry

I had the same issue with IAR or GCC (on MIMXRT1010-EVK).


After some experimentation I found that I could overcome the problem on the i.MX RT 1011 by adding

    extern void *uMemcpy(void *ptrTo, const void *ptrFrom, size_t Size)
    {
        void *buffer = ptrTo;
        unsigned char *ptr1 = (unsigned char *)ptrTo;
        unsigned char *ptr2 = (unsigned char *)ptrFrom;
        while (Size-- != 0) {
        #if defined iMX_RT1011
            *ptr1++ = fnSynchronisedByteRead(ptr2++);
        #else
            *ptr1++ = *ptr2++;
        #endif
        }
        return buffer;
    }‍‍‍‍‍‍‍‍‍‍‍‍‍‍

synchronisation after each read access.

unsigned char fnSynchronisedByteRead(unsigned char *ptrByte)
{
    unsigned char Value = *ptrByte;
    __DMB()
    __DSB();
    return Value;
}
‍‍‍‍‍‍‍

I don't need this when using the same code on any other i.MX RT parts.

Also I don't know whether it is the data or instruction synchronisationn that allows it to operate (I didn't experiment yet) but with these the operation has been fully reliable (and without it fails).

The workaround is acceptable for me for the moment.

Regards

Mark