The PSoC SPI slave will receive the slave select signal, and from there read the data thats clocked in. When a byte has received, it can fire an interrupt. Just listen to that. Maybe read the SCP SPI data sheet first, too.
for text messages standard UART is more appropriate. Can you stay with UART?
Thank you for your answer. I have read te data sheet and a few examples too but I am still lost!
Say that I have named the SPI block as "SPI", then the data you are saying are stored in SPI_mosi_s_Read() ? because when I read from that I only get 01 as a result in my LCD
Yes I could stay with UART and in fact I am going to try it right now! Thank you for your comment!
I still haven't managed to make it work.
Do you have any tutorial or example that you could share please?
You are looking for SCB_SpiUartReadRxData(). The SPI slave puts the data it has received in its internal FIFO, and this function retrieves the first element from there.
Thank you so much for your help Odissey1.
I managed to create an I2C communication between arduino (master) and PSoC (slave).
I will now try to create the UART based communication based on the example you shared! Thanks again
I am trying to modify the code you provided me with, but this command
says that is invalid in C99 and creates an error when building the project.
don't bother, it was a typo!!
the correct command is
RX_Int_StartEx(MyRxInt); //capital "X"
I will post the code once it is functioning
OK, so I finally did it with UART.
I based my code to UART_RX example. Now I can send commands from my arduino to my PSoC using Serial.write(" ") .
baud rate is at 57600 in both boards, when PSoC understands that a message is incoming it receives it and creates a string that contains that message.
Here is the code, I hope it will help some people.
char8 ch; /* Data received from the Serial port */
char strmsg; /* string that holds commands from master*/
int i = 0; /* for counting */
CyGlobalIntEnable; /* Enable all interrupts by the processor. */
/* Check the UART status */
ch = UART_1_GetChar();
/* hold this char as the first char of our string */
strmsg = ch;
/* If byte received */
if(ch > 0u)
for(i = 1; i<=8; i++) /* fill the rest of the string */
strmsg[i] = UART_1_GetChar();
LCD_Char_1_PrintString(strmsg); /* Print the received string */
/* print the size of the buffer on the line below - optional */
//LCD_Char_1_PrintInt8(UART_1_GetRxBufferSize()); /* Prints the count in the LCD */
UART_1_ClearRxBuffer(); /* clear buffer */
CyDelay(1000); /* wait a sec */
LCD_Char_1_ClearDisplay(); /* clear LCD */
Can you explain how you managed to create an i2c interface between Arduino and PSoC?