cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC Creator & Designer Software

Anonymous
Not applicable

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 ?

0 Likes
19 Replies
RaAl_264636
Contributor II

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

0 Likes
Anonymous
Not applicable

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 .

0 Likes
RaAl_264636
Contributor II

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

0 Likes
Anonymous
Not applicable

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 .

    }

}

0 Likes
RaAl_264636
Contributor II

karantak2013_2068006 schrieb:

i have not connected any slave .

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

Regards

0 Likes
Anonymous
Not applicable

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 

0 Likes
HeLi_263931
Honored Contributor II

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.

0 Likes
JoMe_264151
Expert II

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

0 Likes
RaAl_264636
Contributor II

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

0 Likes
Anonymous
Not applicable

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

0 Likes
HeLi_263931
Honored Contributor II

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).

0 Likes
Anonymous
Not applicable

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 .

0 Likes
HeLi_263931
Honored Contributor II

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?

0 Likes
HeLi_263931
Honored Contributor II

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.

0 Likes
Anonymous
Not applicable

Yes , i am getting similar waveform  , look at the data you got , it looks like 0010 0101  , instead of 0101 0101 .

what do u say .?? is it not interesting .??

0 Likes
RaAl_264636
Contributor II

look at the data you got , it looks like 0010 0101  , instead of 0101 0101 .

Nope, he gets 0x55 as intended. Even his scope says it's 0x55 (look at the bottom of the screenshot).

You can check: on the first rising edge of clock, the data line is zero, on the next rising edge it's one, repeating four times, equals to 0x55

0 Likes
Anonymous
Not applicable

ohk , i agree with this but still my code is not working with SCB block with same drivers .

Do i need to clear the interrupts or what .

or Do i need to change any settings .??

if you check same transmission of 0x55 data with UDB block  , you will find perfect waveform .

0 Likes
RaAl_264636
Contributor II

The real question is what your memory device gets on all four lines (MOSI, MISO, SCLK and /SS) for both UDB and SCB version. Then it should be possible to check what's going wrong.

Regards

0 Likes
HeLi_263931
Honored Contributor II

OK, its obvious now that the SCB is behaving as intended on your board.

I already wrote what is wrong with your code. Looking at the UDB version, the read_sr() function is wrong there too since it never reads the status register at all. You might just have been lucky that it always read a 1 for the 'ready' flag (and probably the value you get from an empty RX FIFO is the change between UDB and SCB version you are looking for).

You never check the SPI for completion - the write functions just place data into the TX FIFO, but do not wait for the data to be send. In read_sr() you don't send the needed dummy bytes.

0 Likes