Although I can not think of a reason why your issue is happening,
I tried the following test with CY8CKIT-059.
I could not observe your problem, so would you test your hardware with similar program?
#define STR_LEN 64
char str[STR_LEN+1] ;
void print(char *str)
print("\033c") ; /* reset */
print("\033[2J") ; /* clear screen */
print("5LP SPI Test") ;
snprintf(str, STR_LEN, "(%s %s)\n", __DATE__, __TIME__) ;
CyGlobalIntEnable; /* Enable global interrupts. */
uint8_t outval = 0x01 ;
uint8_t inval = 0 ;
while(SPIM_GetRxBufferSize() < 1) ;
inval = SPIM_ReadRxData() ;
snprintf(str, STR_LEN, "out: 0x%02X -> in: 0x%02X\n\r", outval, inval) ;
inval = 0 ;
Tera Term log
(1) MISO and MOSI were open
Note: I was not expecting the inval has same value with outval.
Probably as I assigned MISO and MOSI to neighbor pins, they may have affected.
(2) So I connected MISO to GND
Note: inval is alwasy 0x00, which is what I expected.
(3) Next I connected MISO to VDD
Note: Don't keep this connection for a long time or add some resistor between VDD and the pin.
Hi Moto, it was indeed the Rx and Tx buffer size in the lora module.
Thank you so much.