SPI Problem in Radio Frequency (RF)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
BUTA_1301626
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

I have a project that I've been dealing with for a long time and I can't. can you help me with this?

I have a rf transceiver project. I'm using a total of 2 psoc kits. I use the first on the receiver side and the second on the transmitter side.send information by the transmitter.

I can send the information from the 1.  psoc kit to SPIM (mosi output). I checked the right thing on both the LCD and the oscilloscope.

I used SPIM in the 2. psoc kit. with the help of cable I made the connection to the MISO pin of the second psoc from the MOSI pin of the first psoc.

my goal here is to save the information from the first psoc to the second psoc.

I want to see the data I have recorded on the LCD which is connected to the second psoc.

but the information I want on the second psoc screen does not appear.

first uploaded to psoc  uint8 buffer[64]={0x55,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x50,0x53 ,0x4f ,0x43 ,0x20 ,0x44 ,0x45 ,0x4e ,0x45 ,0x4d ,0x45};

  1. 0x55,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFFèRf preamble
  2. 0x4f ,0x43 ,0x20 ,0x44 ,0x45 ,0x4e ,0x45 ,0x4d ,0x45è hex to ascii è“PSOC DENEME”

  1. I may have made a mistake with my file (creator fileèudea-reciever-son.) I couldnt find it?

also I want to know.

I used "SPIM" in the first psoc. I need to use "SPIM" in my second psoc?1.png

0 Likes
18 Replies
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

For SPI communication, one has to be master and the other has to be slave and the slave select (ss) connection must be made.

One of the PSoC device must be configured as an SPI slave.

Can you please specify which is the final transmitter project and which is the receiving project? There are 5 projects in the workspace.

Please refer to the code example SPI_Design within PSoC creator for an example of setting up master and slave SPI components.

Do let us know if the problem still exists.

Thanks and regards

Harigovind

0 Likes
lock attach
Attachments are accessible only for community members.

Hi Harigovind;

Now the project has only receiver and transmitter projects.

I used SPIM in the receiver section and SPIS in the transmitter section. But the project still did not work.

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

In the project, there are errors in pin configurations. Please make sure that Digital Input pins are used for inputs, such as slave's MOSI, SCLK, SS and master's MISO and Digital Output pins for the others.

Also, in the project, the slave select pins are not attached to a pin and is not configured. Please make sure that slave select pins are configured and connected externally between the PSoC devices.

Please refer the code example, SPIM_Example and SPIS_Example, present in PSoC creator for guidance on how to configure and program 2 PSoC devices for SPI communication.

Thanks and regards

Harigovind

0 Likes

Hi Harigovind;

I have reviewed SPIM_Example and SPIS_Example.but I don't understand that I have to use dma.

Can I provide information flow without using dma?

0 Likes
lock attach
Attachments are accessible only for community members.
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

I have attached two projects (one master and one slave) as an example for SPI communication between two PSoC 5lp. You can refer these and make changes to suit your need.

Please make sure that you connect the MISO, MOSI, SCLK and SS pins externally for communication to happen.

Do let us know if you face any problems.

Thanks and regards

Harigovind

0 Likes

I think i'm doing something wrong. because lcd constantly writes 0000000000.

What should I connect to MISO, MOSI, SCLK and SS pins?

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

The master's pins need to be connected to the respective pins of the slave. That is, master's MISO needs to be connected to slave's MISO, MOSI to slave's MOSI, etc.

These connections needs to be external. Also, the grounds of both the PSoCs need to be shorted.

Please let me know if you still face the problem.

Thanks and regards
Harigovind

0 Likes

Hi;

I made all the connections.(The master's pins need to be connected to the respective pins of the slave. That is, master's MISO needs to be connected to slave's MISO, MOSI to slave's MOSI, etc.)

but there is still a problem. and I can't find out where the problem is.

SPIM RX data:FFFFFFFFFFFFF

SPIS  rx data none??

can the problem be here?(slave code)

while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE));

        /* SPI communication is complete so we can display received data */

           

        LCD_Position(0u,0u);

        LCD_PrintString("SPIS Rx data:");

       

        LCD_Position(1u,0u);

       

        for(i=0u; i<8; i++)

        {

            /* Read from SPIS Rx software buffer */

            LCD_PrintHexUint8(SPIS_ReadRxData());       

        }

IMG_20190404_112736_resized_20190404_112756744.jpg

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

I had checked this program in my kit and it was found to be working. Please make sure that the clock frequencies are the same for master and slave.

The slave is supposed to print atleast "SPIS Rx Data" in the first line of LCD. This is not dependent on the SPI communication. Please verify that the correct program is flashed on the PSoC devices.

Additionally, you can try to remove the infinite loop and send the message only once to check.The master can initiate the communication by pressing reset button. This will send the data only once.

You can put the second (slave) PSoC in debug mode and check when the device exits while(!(SPIS_ReadTxStatus() & SPIS_STS_SPI_DONE)); statement. It executes the next step only after it finishes transaction with master.

Do let us know in case of any updates.

Thanks and regards

Harigovind

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

Did you try the debug mode in PSoC device? Were you able to identify the problem?

Please let us know in case of any updates.

Thanks and regards

Hari

0 Likes

Hi;

LCD showed when it removed the while loop. However, the LCDs show values in the buffer that are unrelated to the values. They show 00000000 and FFFFFFFF values.

I think I need to change the project I need to use the Manchester coding scheme. Can you help with that?

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

So when you removed the loop and transmitted only once, was the data transfer correct? (Just wanted to make sure the connections are correct).

If the data transmission is not correct (if the LCD is not showing the correct result) can you probe the 4 lines and send me the waveforms? We can verify if the data transmission is happening correctly. Please send waveforms of all 4 lines (MISO, MOSI, SCLK, SS).

Regarding the manchester coding scheme, could you specify the need for it? Because the SPI communication block implemented in PSoC is not designed for manchester coding of data.

Thanks and regards

Harigovind

0 Likes

Hi;

I'm sending the waveforms of the manchester coding required for the transmitter and receiver.Ekran Alıntısı.JPG

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

I wanted the practical waveform you are obtaining in the MISO, MOSI, SCLK and SS lines. I wanted to check if the data is being correctly transmitted by the PSoC device.

Thanks and regards

Harigovind

0 Likes

Hi;

My kit is broken. I'il try the new one when it comes.

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello

Were you able to try out the code and obtain waveforms in the new board? Please let us know in case of any updates...

Regards

Harigovind

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi


Is there any update on the issue? Were you able to obtain the waveforms?

Regards

Harigovind

0 Likes
Hari
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi

Can you send the waveforms obtained from the lines?

Thanks and regards
Harigovind

0 Likes