2024-08-03 02:43 AM
Hello,
I am trying write a LoRa library to STM32F446VET7 in my application.
In the LoRa E220-400T30S documentation, it tells me to set the UART settings for configuration mode to 9600 and 8N1 and to give 1 to M0 - M1 pins.
After doing that I am trying an exampe in below of the document
I am sending "C10004" and I have an interrupt for receive function for RX. But I got nothing in buffer...
I'm using UART for the first time, so I can't even guess what I'm doing wrong. I would be very grateful if you can help me.
Solved! Go to Solution.
2024-08-03 03:52 AM - edited 2024-08-03 08:50 AM
Send as three bytes not as an ASCII string
2024-08-03 02:55 AM - edited 2024-08-03 03:20 AM
Is the UART RX interrupt actually triggered? You will be able to check with debugger breakpoint or onboard LED.
If interrupt is not triggered, check the NVIC configuration, likes HAL_NVIC_EnableIRQ().
Make sure interrupt handler can call the HAL driver's callback. HAL_UART_RxCpltCallback function is executed by the UART interrupt handler:
void USART1_IRQHandler(void)
{
HAL_UART_IRQHandler(&huart);
}
(examples are about USART1. You need to find an interrupt handler suitable for your hardware.)
If the connection between hardware cannot be guaranteed, the loopback test will be helpful for diagnosis. Tie the TX pin and the RX pin and send any data. check the RX interrupt occurs and the RX data is the same as the TX data.
2024-08-03 03:52 AM - edited 2024-08-03 08:50 AM
Send as three bytes not as an ASCII string
2024-08-03 04:14 AM
I did it after posting this nothing changed still not working :(
Send
Receive
2024-08-03 04:44 AM
Hi again,
adding a delay after M0 and M1 set to 1 is worked for me...
Thanks for answering. Now I got a question again
This is the format of set and read a register.
in set register E.g.2 :
C0 is the write command
00 is the start address
04 is the length
that means it gonna read 4 byte data started from 0x00.
0x00 = 12
0x01 = 34
0x02 = 00
0x03 = 61
but in the register map 0x02 should be
0110 0000 = 60 or
0110 0001 = 61 or
0110 0010 = 62.
instead of 0x02 = 61, there is a 0x03 = 61?
2024-08-03 05:02 AM
I read the register. There is nothing wrong.
Document document incorrect.