Still having SPI/EEPROM 'Read' problems

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Still having SPI/EEPROM 'Read' problems

Jump to solution
1,455 Views
jameswhitney
Contributor II

Still having trouble reading a UID code from a Microchip 25AA02UID attached to a LPC54114 Xpresso board. I have carved up a copy of the 'spi_polling_flash' project.

I can now see some action on the MISO line, but the returned values are not correct (i.e., still four bytes, all '0'). A potentially bigger problem is the clock doesn't seem active for the required number of cycles. Any suggestions ?

In the 'flash project the first call to the callback is sent an array with the 'opcode', i.e., 'read' (0x03) and an address '0xFC' (though I tried other values).

CMD[0] = 3;

CMD[1] = 252;

CMD[2] = 0;

CMD[3] = 0;

CMD[4] = 0;

Somehow, on return the 'CMD' array returns with:

CMD[0] = 0

CMD[1] = 0

CMD[2] = 2

CMD[3] = 32

CMD[4] = 49

Against hope, these *ARE NOT* the expected UID values.

In the second call, the callback is sent an array to receive the data spooled from the 'SO' signal. I.e.,

destBuff[0] =  0;

destBuff[1] =  0;

destBuff[2] =  0;

destBuff[3] =  0;

After the callback returns printf of destBuff gives

destBuff[0] =  0

destBuff[1] =  0

destBuff[2] =  0

destBuff[3] =  0

I.e., no change in value.

ReadingManufCode.jpg

CODE in .PDF and .TXT attached

Labels (3)
Tags (2)
0 Kudos
1 Solution
1,294 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi James WHitney,

   Do you short JP6 on your LPCXpresso 54114 board?

pastedImage_1.png

This is very important when you use the PMOD interface.

From your last post wave, it seems your SPI didn't connected correctly.

Have a great day,
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
7 Replies
1,294 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi James,

   Sorry for my later reply!

   What's the code you are using?  It seems you are using the SDK code for LPC54114.

  Actually, in the SDK SPI sample code, there has a project use the SPI to control the external mx25r flash, you totally can refer to that project.

SDK_2.5.0_LPCXpresso54114\boards\lpcxpresso54114\driver_examples\spi\polling_flash\cm4\iar

1. Please note the pin_mux.c

   Do you configure the according SPI pins correctly? Enable the pull up function.

2. Modify the according flash code to your own flash SPI sequence.

From my own opinion, I think you can test the polling_flash project directly on your side, just make sure the SPI wave is correct, then you can modify the hardware to connect your own flash, it will be more easy to you.

Please try it on your side.

If you still have question about it, just let me know.

Please also let me know your picture each wave function, eg, which color is the MOSI,etc.

Have a great day,
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 Kudos
1,293 Views
jameswhitney
Contributor II

Good morning, Kerry,

Traces:

Yellow - Chip select

Blue - MISO

Purple - clock

Green - MOSI - Read command and address.

Yes, using SDK. I looked at the MX25 example that both you and Alice Yang suggested. I noticed:

1 - The example had significantly more features than I needed. I deleted most of them.

2 - Really didn't really illustrate what I needed. My modified code should have the same functionality.

3 - In the end, the API to transmit the SPI data - SPI_MasterTransferBlocking - is exactly the same as that used for the b2b example, so should perform exactly the same. Alice pointed out that it may be necessary to send the 'opcode' and address in one SPI call, then get data with a second call. I have done this.

4 - Already using the other ports for other devices so stuck with using Port 3

- I have attached copies of my code. NOTE: The 'Main', Flash.c, and Flash.h are *all contained in the single file*.

- I kept *only* the relevant section of all the programs.

- Why *does not* the clock signal go for at least 32 cycles ?

Kerry, I matched up my signals/generation with the example that you suggested to Ronan and *everything* lined up exactly, so I know that my basic implementation is correct. Additionally, I have checked with the scope and 'CS', and command/address are also correct. Again for some reason - to me - it seems in my current case that the clock should be longer.

Thank you,

Jim

0 Kudos
1,293 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi James,

   Please provide these information to me:

1. Share your 25AA02UID schematic, I need to check whether your external EEPROM circuit have problems or not.

2. Share the photo about the connection between the external EEPROM and  your LPCXpress 54114 board

3. The 25AA02UID VDD and VSS should powered by the LPCXpresso54114 board, it is 3.3V supply.

4. Provide your whole test project about the EEPROM, you can deleted all the other functions, just give me the simple project which can reproduce the problem.

  Please also tell me what the IDE you are using.

5. Tell me the SPI pin you are using in the LPCXpressso54114, eg SPI_CS is J1_XX, then I will help you to test it, it will save both you and my time.

Waiting for your updated information.

Have a great day,
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 h

0 Kudos
1,293 Views
jameswhitney
Contributor II

Kerry,

For some reason, depending on which tool is used for 'Reply', the 'Use advanced editor' option does *not* always appear.

Find the project attached.

Answers to *all* the other requests were contained in the prior email. Please let me know if they do not appear.

Regards,

Jim

0 Kudos
1,295 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi James WHitney,

   Do you short JP6 on your LPCXpresso 54114 board?

pastedImage_1.png

This is very important when you use the PMOD interface.

From your last post wave, it seems your SPI didn't connected correctly.

Have a great day,
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 Kudos
1,293 Views
jameswhitney
Contributor II

Kerry,

Thanks, once again.

Jim

0 Kudos
1,293 Views
jameswhitney
Contributor II

1. Share your 25AA02UID schematic, I need to check whether your external EEPROM circuit have problems or not.

   Pin 3 (Write-Protect) and Pin 7 (Hold) are active low. These are pulled up to Vcc (Pin 8).

25AA02UID_PinOut.png

2. Share the photo about the connection between the external EEPROM and  your LPCXpress 54114 board

IMG_4092.JPGIMG_4093.JPG

In the left figure, as the board is *upside down*, Pin 1 is in the upper right. Can see Pins 7 and 3 connected to Pin 8 (Vcc=Vdd)

In the right figure all connections are to the upper row of the J4 PMOD connector *EXCEPT* 'Chip Select' which goes to J4, pin 7. NOTE that *unlike* DIP package, Pmod pin numbers go top-to-bottom (i.e., holding the board vertically) *on both columns*. Column 1 are pins 1-6, Column 2 are pins 7-12.

3. The 25AA02UID VDD and VSS should powered by the LPCXpresso54114 board, it is 3.3V supply.

    They are: Vdd - J4, Pin 6 and Vss - J4, Pin 5  on Pmod connector

4. Provide your whole test project about the EEPROM, you can deleted all the other functions, just give me the simple project which can reproduce the problem.

       OK. I do not see the 'Advanced' icon. If I do not see it when I 'Post', I will attach to a separate mail.

  Please also tell me what the IDE you are using.

      Using MCUXpresso V10.3.0

5. Tell me the SPI pin you are using in the LPCXpressso54114, eg SPI_CS is J1_XX, then I will help you to test it, it will save both you and my time.

        SIGNAL           LPCXpresso Pin#          25AA02UID Pin #

         SPI_CS             J4, Pin 7                          Pin 1

        SPI_CLK            J4, Pin 4                          Pin 6

        SPI_MOSI          J4, Pin 2                         Pin 5  (SI)

        SPI_MISO          J4, Pin 3                         Pin 2  (SO)

        Vdd (+3.3)          J4, Pin 6                         Pin 8

        Vss (GND)         J4, Pin 5                          Pin 4

0 Kudos