cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-WL55JC1 to Custom PCB STM32WL55 UART Communication Not Working.

jflaxman
Associate II

Hello and thank you in advance.

 

I am trying to set up a nucleo-wl55jc1 to send UART data to a custom pcb I made. I will post both IOC files as well as the necessary code to help. I can send data one way (from the pcb to the nucleo) but the other direction, is not working.  

IOC file for nucleo, I am using usart1 for communication between boards, and usart2 for coms to PC for debugging. 

Screenshot 2024-05-04 at 2.04.25 PM.png

 IOC file for custom hardware. Note that the uart pins were initially for the STLINK, however, due to some design changes, they are being used to communicate between boards. 

Screenshot 2024-05-04 at 2.02.43 PM.png

 

 

Here is the code for the receiver that just runs in main. Using the live expressions I can see the data coming in. 

 

 

int UART_ReceiveAndPrint(UART_HandleTypeDef *huart)
{
	while(1)
	{
		  if(HAL_UART_Receive(&huart1, rx_buff, 10, 1000)==HAL_OK) //if transfer is successful
		  {
			  __NOP();  // toggle LED
//	            printf("received data\n");
//You need to toggle a breakpoint on this line!
		  } else {
		    __NOP();
		  }
	}

    return 0;
}

 

 

 

 

 

void UART_SendFixedStringEveryFiveSeconds(UART_HandleTypeDef *huart)
{
    const char *str = "Hello, UART Receiver!";  // Hardcoded test string
    uint16_t len = strlen(str);  // Calculate the string length

    while (1) {  // Infinite loop to send the string continuously
        if (len > 0) {
            // Transmit the string over UART
            HAL_UART_Transmit(huart, (uint8_t *)str, len, 1000);  // 1000 ms timeout
        }

        HAL_Delay(5000);  // Wait for 5 seconds
    }
}

 

 

Here is the transmitter code that.

I have RX->TX and TX->RX and GND->GND for the boards. 

 

Viewing the Live Expressions for the RX Buffer I can see 

Screenshot 2024-05-04 at 2.07.55 PM.png

But the new data isn't coming in every 5 seconds and the RxBuff seems to randomly update with random values every once in awhile. 

I tried to follow the STM basic UART tutorial, but cannot get it to work. 

 

1 REPLY 1
STTwo-32
ST Employee

Hello @jflaxman 

Can you test the UART transmission from the Nucleo is happening (using a logic analyser or oscilloscope) if so, try to test reception on the PCB side.

Best Regards.

STTwo-32 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.