This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28388D: SPI外扩SPI NOR FLASH

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Expand an SPI NOR FLASH through the SPIC channel of 28388D, currently modifying spi_ex6_eeprom.c

Path: C:\ti\c2000\C2000Ware_3_04_00_00\driverlib\f2838x\examples\c28x\spi

nor  flash: MT25QL02GCBB8E12-0AAT

I modified the following places:

#define RDSR                        0x05

#define READ                        0x03

#define WRITE                       0x02

#define WREN                        0x06

#define WRDI                        0x04

#define WRSR                        0x01

The pin connections on the hardware have also been modified.

The channels are changed to  SPIC.

After this modification, I downloaded the program to 28388D RAM, and found that the read buffer value was wrong.

Is there no modification?

I'm here for advice and solutions.

thanks!

  • Vince,

    SPI EEPROM example code provided is configured to work for AT25128/256 and not for MT25QL02GCBB8E12.

    You need to adapt the code for MT25QL02GCBB8E12. Are you making sure SPI read command is correctly getting transmitted as expected by MT25QL02GCBB8E12?

    Have you check with MT25QL02GCBB8E12 vendor how read operation needs to be performed? Did you get any other register read operation working correctly.

    Regards,

    Manoj

  • MT25Q (128Mb, 256Mb, 512Mb, 1Gb, 2Gb) General Low-Level Driver_v1.8.rar

    The supplier of MT25QL02GCBB8E12-0AAT is micron.

    They provided a General Low-Level Driver.

    At present, it is trying hard to base on the routine spi_ex6_eeprom.c, and then add the routine provided by micron.

    I tried this modification method myself, tried many times, but it didn't work.

    MT25Q_QLKT_L_02G_CBB_0-1387306.pdf

    Which parts of the routine spi_ex6_eeprom.c should be modified to make the modified routine work on the 28388D, so that the SPI FLASH can be read, written and erased.

    Here to ask

    Thank you!

  • Vince,

    To start with macro definition for EEPROM needs to change. These are meant for EEPROM and not for the SPI flash you're working with.

    First step would be to check whether you're able to read "READID" defined in SPIFlash datasheet in pg:31,40. Are you able to successfully read "READID"?

    Regards,

    Manoj

  • In the spi_ex6_eeprom.c routine, it seems that there is no erase part, only read data and write data.

    In the spi_ex6_eeprom.c routine, I modified the following parts:

    Refer to the content in the datasheet to modify:

    Run results after modification:

    What you said, READID, I don’t know what it means. I only found:

    I also hope that I can get support.

    If my thinking is wrong, please help me revise a version, because I have tried many kinds of revisions here, but they have no effect.

  • Vince,

    Sorry, I can't provide custom code for each SPI flash out there in the market. We have showcased how you to configure SPI for particular EEPROM. This SPI EEPROM example would be good start point to port to SPI Flash (MT25QL02GCBB8E12). If you have specific questions about C2000 SPI I can answer. But, I'm not in position to modify the code for you. Generally SPI Flash vendor provide example which can be used to understand how SPI flash works. Have you checked with Micron on how to talk to their SPI flash?

    Here the pseudo code can need to try to read manufacturer ID

    1) Pull chip select pin low

    2) Transmit 0x9F (or) 0x9E (8 bits only) using SPI_writeDataBlockingNonFIFO(SPIA_BASE, 0x9F); to perform READID operation.

    3) Read manucturer_ID = temp = SPI_readDataBlockingNonFIFO(SPIA_BASE);

    4) If temp == 0x20, then you have read manufacturer ID correctly like what is mentioned in MT25QL02GCBB8E12 

    5) Pull chip select pin high

    Regards,

    Manoj

  • Yes, when the external FLASH is written into the program, it needs to be erased before it can be written. I will try again and I have already contacted micron.

  • I tried it like this and found that temp=0x9ffff

  • Vince,

    Reading 1 byte of information using READID command (0x9F) should give you 0x20. This information is provided in SPI flash datasheet.

    I have made a mistake in above pseudo code. Try this approach mentioned below. I have highlighted the changes in red from previous pseudo code.

    1) Pull chip select pin low

    2) Transmit 0x9F (or) 0x9E (8 bits only) using SPI_writeDataBlockingNonFIFO(SPIA_BASE, 0x9F); to perform READID operation.

    2a) Dummy perform dummy read with temp = SPI_readDataBlockingNonFIFO(SPIA_BASE);

    2b) Dummy transmit to receive manufacturer ID information SPI_writeDataBlockingNonFIFO(SPIA_BASE, 0x0000);

    2c) Clear temp = 0 variable

    3) Read manucturer_ID = temp = SPI_readDataBlockingNonFIFO(SPIA_BASE);

    4) If temp == 0x20, then you have read manufacturer ID correctly like what is mentioned in MT25QL02GCBB8E12 

    5) Pull chip select pin high

    Regards,

    Manoj

  • Vince,

    I hope you are monitoring SPI pins when you run your code. From C2000 SPI perspective you are just transmitting 0x9F followed by 0x0. You should see 0x9F and 0x0 transmitted on SPIMOSI pin.

    Regards,

    Manoj