MCB2300 + SPI serial flash issue

Hello,

I'm trying to use the MCB2300 board (LPC2378) with an external serial flash using SPI (ST M25P80).
First, I used SPI without interrupt and it works without any problem. But LPC2378 SPI has a maximum clock of 9MHz (with a 72MHz master clock). And I would like to use my flash with a faster clock.

So I tried to use the SSP. I didn't manage to use it without interrupt (I never read something although my write signal seems to be good on the scope). Then I tried to use SSP with interrupt. Sometimes I can read and erase some bytes and sometimes not.

Moreover, I tested to use the automatic "SSEL" chip select, set by LPC2378. But it seems to deselect between 2 frames and it's not compatible with my serial flash according to the datasheet. So I tried a manual chip select, with a GPIO, between each instruction. Without any success.

Here is my sequence :

Start
InitSPIMaster(); // initialize the driver
B = SPI_ReadStatus();
SPI_ReadData(0,P1,2); // Read data (2 bytes in P1 array) from address 0
SPI_EraseChip();
SPI_ReadData(0,P1,2); // Read data
SPI_WriteEnable(1); // Enable Writes
SPI_WriteData(0,P0,2); // Write data (2 bytes from P0 array) in address 0
SPI_ReadData(0,P1,2); // Read data
End

Is there something wrong ?

According to me, the SPI initialisation is good, since the 'read status' and 'write' function looks good.

I had to this that I started my work with the 'lpc_ssp.c' and 'lpc_ssp.h' library from C. Strahm (found on web).

Could someone help me please ?

Thank you so much in advance.

Aurelien

Parents
  • You are not showing where you are setting your SSEL-signal in relation to your reads and writes. Is it in SPI_ReadData() and SPI_WriteData()?

    I have been using the SSP and I had to drive the SSEL signal as GPIO since the automatic drive did not correspond with my needs.

    Are you waiting until the SSP device is idle before deselecting SSEL? Note that the SSP has a FIFO so you can write multiple bytes to it that it will then continue to send as fast as it can.

    But with this as with most other problems relating communication: Have you looked at the signaling with an oscilloscope? Based on the oscilloscope view:
    - what did you expect to happen?
    - what did happen?
    - what was the exact code involved?

Reply
  • You are not showing where you are setting your SSEL-signal in relation to your reads and writes. Is it in SPI_ReadData() and SPI_WriteData()?

    I have been using the SSP and I had to drive the SSEL signal as GPIO since the automatic drive did not correspond with my needs.

    Are you waiting until the SSP device is idle before deselecting SSEL? Note that the SSP has a FIFO so you can write multiple bytes to it that it will then continue to send as fast as it can.

    But with this as with most other problems relating communication: Have you looked at the signaling with an oscilloscope? Based on the oscilloscope view:
    - what did you expect to happen?
    - what did happen?
    - what was the exact code involved?

Children
More questions in this forum