Skip to main content
Associate II
June 24, 2025
Question

UART1 RAK3172 (STM32WLE5CCU6)

  • June 24, 2025
  • 3 replies
  • 969 views

 

Hello, I’m facing an issue using the RAK3172. In my project, UART1 is configured for debugging and LoRaWAN logs, while UART1 (PB6/PB7) is reserved for communication with the LC76G GPS module.

However, I'm unable to print any data from the GPS module to the monitor. So, I performed two steps to verify whether the module is actually working:

  1. I checked the current consumption using a multimeter;

  2. I soldered a wire directly to the module's TX pin and used a TTL converter to confirm that NMEA data is indeed being sent.

Based on that, I searched the forum and saw that others have experienced issues with UART1 on this module, but I couldn’t find a clear solution.

These are the two functions I’ve implemented so far, and I’m calling them during the LoRa initialization. I’d like to point out that they were used successfully in a previous project with an STM32L4, and everything worked fine there.

void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if (huart == &huart1)
{
printf(gpsData.rxDataBuffer);
}
}

void GPS_reset(GPIO_TypeDef *GPIOx, uint16_t pin)
{
HAL_GPIO_WritePin(GPIOx, pin, RESET);
HAL_Delay(500); // datasheet = 100ms, but this seemed too short
HAL_GPIO_WritePin(GPIOx, pin, SET);
printf("RESET DONE\n");
}

 

3 replies

Karl Yamashita
Principal
June 24, 2025

Test the UART1 in loopback. Short the Tx to the Rx pins and send some data. You should be able to get calls to  HAL_UARTEx_RxEventCallback. If not, then you have some configurations to look at. Worse case, damaged peripheral.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
samuelbsAuthor
Associate II
June 25, 2025

Hi Karl, thank you for your response.

 

I’ll run the test and get back to you with feedback later. But I believe it might be something related to configuration, since I have two different projects that use the GPS on UART1 and both are showing the same issue.

 

Also, just for reference: in order to use the ADC with DMA, I had to reinitialize it every time before using it, and I saw that some people did something similar with UART, but I haven’t had any success with that so far…

 

Looking forward to your reply. Talk to you soon.

Karl Yamashita
Principal
June 25, 2025

Looks like you're using HAL_UARTEx_ReceiveToIdle_DMA?

See my signature with a tutorial that shows how to configure the USART. 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
Karl Yamashita
Principal
June 25, 2025

Edit: replied to wrong post

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
samuelbsAuthor
Associate II
June 25, 2025

Hi Karl, I'm sending the IOC file attached. If you need anything else, please let me know.

I'll watch the videos and get back to you with feedback. But I’ll only be able to test later today, as I’m working off-site.


Karl Yamashita
Principal
June 26, 2025

@samuelbs wrote:

Hi Karl, I'm sending the IOC file attached. If you need anything else, please let me know.

I'll watch the videos and get back to you with feedback. But I’ll only be able to test later today, as I’m working off-site.



Sorry, i replied to the wrong thread when i asked for the IOC file, lol.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
samuelbsAuthor
Associate II
June 27, 2025

Hello,

I still haven’t been able to figure out why it’s not working. But one thing is certain: I’m completely disappointed with the STM32WL (RAK3172) programmed via STM32CubeIDE… It’s unbelievable that UART1 doesn’t receive anything. The connections are correct, the configurations are set, and I can see data coming out of the GPS TX, yet nothing is received by the module. I also don’t believe it’s a hardware issue, since two boards from different designs exhibit the same symptom.

Karl Yamashita
Principal
June 27, 2025

Being it's a custom board with an STM32WLE5, you should contact RAK for help.  

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
samuelbsAuthor
Associate II
June 28, 2025

Hello,

I managed to find the solution. To do this, I found how the system works in the PDF: https://www.st.com/resource/en/application_note/an5406-how-to-build-a-lora-application-with-stm32cubewl-stmicroelectronics.pdf.

Basically, the stack operates with the sequencer scheduling the tasks. With that in mind, I followed these steps:

  1. Created a new task;

  2. Called the task when needed (in my case, when the GPIO is triggered);

  3. Reinitialized UART1, and that was it.

Now I plan to implement UART1 with DMA, but for now, this is already working great for me.

I hope this helps someone else as well. Just a reminder: the PDF contains the most valuable information on how the system works.