1 2 3 Previous Next 32 Replies Latest reply on Apr 14, 2017 8:35 PM by moro_1580446

    running AT25F2048 with psoc5

    moro_1580446

      Hi every body.I use an electronic board that contain at25f2048(eeprom).So i want to connect psoc5lp prototype kit with this eeprom chip.I want to know how can i use eeprom component in psoc creator to write and reed in my chip?

         

      tanks for your attention and supporting...

        • 1. Re: running AT25F2048 with psoc5
          JoMe_264151

          Datasheet of at25f2048 tells that it uses an SPI interface. So drop an SPI Master component onto your topdesign and write some lines of code to access it as required.

             

           

             

          Bob

          • 2. Re: running AT25F2048 with psoc5
            moro_1580446

            Tanks dear Bob.why i cant use eeprom component or emfile in psoc creator to reed or write on at25f2048?

            • 3. Re: running AT25F2048 with psoc5
              JoMe_264151

              EEProm component is for the PSoC5 internal eeprom (2kB). The emfile component allows for os-compatible sd cards.

                 

              All eeprom is prone for power-losses while programming is in progress. A power supply that can overcome some 20ms line losses should be considered.

                 

               

                 

              Bob

              • 4. Re: running AT25F2048 with psoc5
                moro_1580446

                Hi MR Bob Marlowe.i cant runnig and get RDID(chip id).so please see my code and tell me why it is not working?

                   

                please see my code here :

                   

                #include <project.h>
                #include <stdio.h>

                   

                #define RDID 0b00010101
                uint8 readid=0u;
                int main()
                {
                    
                    CyGlobalIntEnable; /* Enable global interrupts. */
                    
                    UART_Start();
                    SPIM_Start();    
                    
                    for(;;)
                    {
                        
                        //SPIM_WriteByte(RDID);
                        SPIM_WriteTxData(RDID);
                        while(readid==0u)
                        {
                            readid=SPIM_ReadRxData();
                            //readid=SPIM_ReadByte();
                        }
                        UART_PutChar(readid);
                        CyDelay(500u);
                        UART_PutChar('\n');
                        
                        readid=0u;
                        CyDelay(5000u);

                   

                    }
                }

                • 5. Re: running AT25F2048 with psoc5
                  JoMe_264151

                  You read from SPIM without checking / waiting before a byte has been received. Use API SPIM_GetRxBufferSize() to see how many bytes there are. UART_PutChar() will not write ASCII chars, I would suggest using sprintf() to convert to a readable string.

                     

                  For every bit (byte) the SPI interface gets, one bit (byte) is returned immediately. When the very first byte is sent, the interface does not "know" yet what to answer, so a dummy byte is returned which should be skipped.
                  SPI has no read command, so you must send dummy bytes to retrieve the information wanted.
                  A pitfall is the select line, which is automatically taken low when a byte is sent. When the buffer is empty it is taken high again. This can lead to interface errors when the byte sequence is not provided fast enough resulting in ss-line glitches.

                     

                   

                     

                  Bob

                  • 6. Re: running AT25F2048 with psoc5
                    moro_1580446

                    Sorry... I cant understand what should i do for your explanation.can you give me any example for correct send and receive data in spi mode?

                       

                    tank you...

                    • 7. Re: running AT25F2048 with psoc5
                      JoMe_264151

                      See this example...

                         

                       

                         

                      Bob

                      • 8. Re: running AT25F2048 with psoc5
                        moro_1580446

                        tankyou dear Bob...

                        • 9. Re: running AT25F2048 with psoc5
                          moro_1580446

                          Hi Bob

                             

                          I can get chip ID from below code but i cant READ or Write.I cant find where is my mistake and how can i do it.help me plz?

                             

                                  SPIM_ClearTxBuffer();
                                  SPIM_ClearRxBuffer();

                                  SPIM_WriteTxData(RDID);

                             

                                  SPIM_WriteTxData(RDID);
                                  
                                  while (!(SPIM_STS_SPI_DONE | SPIM_STS_SPI_IDLE))
                                  
                                  size=SPIM_GetRxBufferSize();
                                  sprintf(a,"size=%3d",size);
                                  UART_PutString(a);
                                  UART_PutChar('\n');
                                  
                                  while(SPIM_GetRxBufferSize())
                                  {
                                      readid=SPIM_ReadRxData();
                                      //readid=SPIM_ReadByte();
                                  }
                                  sprintf(a,"readid=%3d",readid);
                                  UART_PutString(a);
                                  CyDelay(500u);
                                  UART_PutChar('\n');
                            

                          • 10. Re: running AT25F2048 with psoc5
                            moro_1580446

                            Please see my code here and tell me my question : when i send write register and then send every command that i send back 255.is it worked or not?

                               

                            then i cant read byte in at25f2048.just i see 255.is there any body that know what is my mistake?

                            • 11. Re: running AT25F2048 with psoc5
                              JoMe_264151

                              Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
                              Creator->File->Create Workspace Bundle (minimal)
                              and attach the resulting file.

                                 

                               

                                 

                              Bob

                              • 12. Re: running AT25F2048 with psoc5
                                moro_1580446

                                ok.this is my project...

                                • 13. Re: running AT25F2048 with psoc5
                                  JoMe_264151

                                  You are not following the scheme with the CS-line. The signal is continuosly driven low by your hardware design. Remove the "Logical 0" component, the connection, uncheck the "Hardware connection" in the pin and finally set the  initial drive state to High. Now you can manage the CS state.

                                     

                                  The CS should be taken low just before the transmission starts and must be taken high again when the transmission has finished which can be checked by the number of bytes received in the buffer.

                                     

                                   

                                     

                                  Bob

                                  • 14. Re: running AT25F2048 with psoc5
                                    moro_1580446

                                    tankyou Bob for your explanation.I changed cs confige as you said.but i just get chip id correct and can not write or read on at25f2048.what is my problem?is there any mistake?

                                    1 2 3 Previous Next