1 2 Previous Next 19 Replies Latest reply on Dec 22, 2017 6:11 AM by user_78878863

    Data write issue with SCB SPI of CY8C4247_LQI-483

    karantak2013_2068006

      I have observed different behavior of the Cypress SPI modules on CY8C4247-LQI-483.
      I have use Master mode and submode Motorola, with SCLK mode CPHA=0 and CPOL=0, Oversampling=8,
      RX/TX data bits=8, MSB First, Number of SS:1, Active Low, with a FIFO Buffer size of 8 bytes. The datarate is 1MHz
      and the SPI component has no rx/tx interrupt.

      I have written function to read/write data into adesto flash IC , while using UDB SPI module it worked properly , but in case of SCB SPI module it is not working .
      after debugging , I found that is error in sending sequence of data though SCB SPI component .i just sent the data 0x55 from UDB SPI and observed the waveforms .(for debug I have just use simple library function to write single byte on SPI )
      similarly waveforms observed for SCB SPI .
      I have attached the images which contain the difference in waveforms .

      Has anyone an idea how to fix this issue ?

        • 1. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
          user_246598725

          Hi,

           

          not sure what really happens. It looks like that 0x55 is not written to the SCB SPI bus. Anyway, best thing would be that make an archive of the working and non-working version and provide it here, so other forum members can check the source code.

           

          Regards

          • 2. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
            karantak2013_2068006

            Hello ,

            I have attached both working (i.e UDB SPI working code ) and Non Working (i.e SCB SPI Non working code ).

            Please have a look . !

            Your quick response will be helpful for me .

            • 3. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
              user_246598725

              Hi,

               

              okay, so with those projects the behaviour can be checked. I don't have a 4247 device here, only a 4245, so I adapted the projects to this. From what I can see it seems that on the UDB SPI, the MOSI line goes low after the transmission. This is not the case for the SCB SPI.

               

              However, in both cases the MOSI line is low before the first rising edge on the SPI SCLK signal. So, this is in contrast to the signals you provided - it seems the SCB block works differently between 4247 and 4245.

               

              Maybe there's a forum member having a 4247 device and can check. For completeness, you wrote that your SPI slave is some kind of flash memory. Please provide information about this device, so we can check if there's a SCB configuration which will work with this device.

               

              Regards

              • 4. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                karantak2013_2068006

                Thank u for your support , but this is regarding data byte sending over SCB SPI , basic library function to send data on SPI is not working properly for SCB block , i don't know why this is happening .

                can anyone help me .??

                i just want to send a byte over SCB SPI properly  , i had just included Library function not done anything extra . but still the waveform is not proper (for sent data ), write now i have not connected any slave .

                 

                Following is the function that are used in my basic code .

                 

                int main()

                {

                    SPI_1_Start();   // SPI SCB Start in Master Mode

                    SW_Tx_UART_1_Start();

                    CyGlobalIntEnable; /* Enable global interrupts. */

                 

                 

                    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

                    SW_Tx_UART_1_PutChar('A'); // Debug character

                    for(;;)

                    {

                        /* Place your application code here. */

                        SW_Tx_UART_1_PutChar('A');

                        CyDelay(1000);

                       SPI_1_SpiUartWriteTxData(0x55);      // send data over SPI

                       // NOTE : THIS FUNCTION IS NOT SENDING DATA PROPERLY OVER SPI .

                    }

                }

                • 5. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                  user_246598725

                  karantak2013_2068006 schrieb:

                   

                  i have not connected any slave .

                  Then, how do you know that it's not working?

                   

                  Regards

                  • 6. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                    karantak2013_2068006

                    Sir ,

                    Previously , I wrote the driver to communicate with adesto flash IC , code worked perfectly with UDB SPI , then due to lack of UDB blocks for my application , I had to switch to SCB SPI Mode , which causes failure of data read/write into flash IC.

                    after debug I just found that SBC SPI Library is not working .

                    For debug  :I just send a byte 0x55 to SPI SCB and observed the waveforms at DSO , which looks like that I have attached image in my first comment .

                    its my request to just create a project with SCB SPI , and check SPI transmission by sending a byte , and please verify its waveforms .

                    let me know that i'm doing it into wrong way or something else .

                    Early reply and help will be really beneficial for me .

                    Thanks and Regards 

                    • 7. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                      user_78878863

                      Can you share the project that you used to create the original scope shot? (The one that has a SCB and a UDB SPI master, started at the same time).

                      Or do a new scope shot, using exactly the WorkspaceSCB.cywrk.Archive.zip from above, showing the SCLK, SS and MOSI lines (and maybe the UART TX line too). If possible, try to have the waveform fill out the complete screen, do the photo directly from the front and upload higher quality photo (the original one does not provide enough detail to assess the problem).

                      Make sure nothing else is connected to the SPI pins on your PCB.

                      • 8. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                        bob.marlowe

                        Your waveforms both seem to be correct. Can you additionally scope the ss-line? And  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

                        • 9. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                          user_246598725

                          karantak2013_2068006 schrieb:

                           

                          Previously , I wrote the driver to communicate with adesto flash IC , ...

                           

                          ...and please verify its waveforms .

                          ...let me know that i'm doing it into wrong way or something else .

                          Early reply and help will be really beneficial for me .

                          The first thing you're doing wrong is that you don't provide necessary information even when asked for.

                          I asked you which memory device is not working, and you refuse to give details.

                           

                          You ask for verifying waveforms - how should we check that the waveforms you provided in the first post are the cause of the error? There's no slave select signal shown - now, how should we check if it's maybe possible that the slave select signal is making trouble without having a datasheet to check against it? SPI interface handles data on rising/falling edges - the initial waveforms you provided should both work, since the data lines have the same value on the clock edge. So, maybe there's another thing which we currently cannot see.

                          So, best way is to additionally provide a project which does the first few memory accesses of your project.

                           

                          You ask for early reply, but you're slowing down the process by yourself. So, once again: which memory device exactly, and how it's connected?


                          Regards

                          • 10. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                            karantak2013_2068006

                            Hello .

                            I have attached the code for interfacing of adesto flash IC . with both SPI component i.e UDB and SCB respectfully .

                            also attached the data sheet of adesto flash IC .

                            Please go though it .

                             

                            i will  be greatfull for your help .

                            thanks and regards

                            • 11. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                              user_78878863

                              Since these are two different projects - how did you get them to be on the same scope photo? AFAIK for now the code behaves as intended on a '4245. So the reason might be in your board (is it a Cypress board, or something you made yourself?), or in the way you are using the scope.

                              Oh, and looking at the SCB project: this is not the one you have used to create that scope photo.

                              Looking at the code: before you do SPI_1_SpiUartReadRxData you need to check that the data transfer has actually finished, otherwise you might get garbage. And you need to send the dummy byte (the code you commented out).

                              • 12. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                                karantak2013_2068006

                                I'am using CY8CKIT-042-BLE PIONEER BASEBOARD .

                                i think there is confusion, scope images are of different projects white wavefrom is taken as reference for UDB block  , and yellow waveform are for SCB .

                                One component is taken at 1 time .

                                 

                                Yes , the scope images are taken after debugging they are only for single byte send .

                                At scope images , i have shown the comparison for UDB and SCB .

                                • 13. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                                  user_78878863

                                  The problem is that we cannot see SCLK for the SCB version - thats what is interesting (together with SS). Can you do a (bertter quality) scope photo just for the SCB version transferring a 0x55?

                                  • 14. Re: Data write issue with SCB SPI of CY8C4247_LQI-483
                                    user_78878863

                                    Since I do own a CY8CKIT-042-BLE PIONEER board (not the A version, though), so I tried your WorkspaceSCB.cywrk.Archive.zip (the one that should transfer a 0x55 over SPI). This is what I got on my scope:

                                    scope_0.png

                                    Looks as if it works as intended. If you cannot get that one to work, you have either a problem in your board, in something you have attached to it, or with your scope setup.

                                    1 2 Previous Next