UART communication problems with RN2483A

Hi,
i am using the RN2483A module (firmware vers. 1.0.5) with an STM32 microcontroller. Until now all works fine with the communication over UART interface, but now I want to implement a status check with command mac get status, the UART-RX interface of my microcontroller doesn’t work anymore or I would better say that the UART-RX interrupt is not triggered.

The cause of the problem must somehow be related to the sleep/wakeup of the RN2483A module because it works perfectly when I don’t put the module into sleep mode.

These are the steps in my code:
1.) RN2483_reset(); // response is the firmware version
2.) mac_get_status(); // response 00000000
3.) joinOTAA(); // response 1. OK, 2. after a few seconds accepted
4.) RN2483_sleep();
5.) RN2483_wakeUp(); // response ok
6.) wait 200ms
7.) mac_get_status(); // response 00000810 but no UART RX-Interrupt was triggered
…here I got the correct response from the module -> see the scope image
8.) Transmitte some data wit mac tx uncnf 1 xxxxx // works fine
9.) RN2483_sleep(); // repeat from point 4

Has someone an idea where the failure could be here?

Statusbyte:
Statusbyte

Signals during wake-up:
wakeup_RN2483

Problem solved!

During changing the baud rate for wake up event i forgot after reinitialization of UART:

HAL_UART_Receive_IT(&huart2, rxData, 1); // receive 1 byte in interrupt mode

Hello, I’m working on a smart metering projectwith STM32L071 and a RN2483 LoRa module ( through UART) and i can’t find out how i could configure my RN2483 module with STM
In other words how did you configure the RN2483 RESET , sleep, wakeup functions etc … ?

Are you writing a TTN application from scratch ?

Normally the basics of how to configure the RN2483A would be part of a basic program that you adapt to your particular needs.

2 Likes

Thank you for you reply, let me explain what I’m doing this is my graduation project and it’s about the realization of an electronic board containing an optocoupler, a STM32l071 and a LoRa module : RN2483 all of this is attached to an electric meter in order to decode the frames comming from it then extract the value of the electricity consumption to finally send it to the RN2483 to store it into the cloud and I have to write the script that assure the communication between the STM32 and the electric meter and the optocopler which is done and the second script is for the communication between the STM32 and the RN2483 to send the data from the STM to the LoRa module and thats where I’m stuck i cant know what i have to write in the script how to configure the RN2483 through a stm32l071 script and how to let the RN2483 receive the data through the UART of course. I hope i have understood me and thank you in advance .

There will be examples of how to use the RN2483 to connect to TTN, a quick Google search found this for instance;

Via TTN the data sent from the node can be displayed on Internet web servers or sent to databases if you wish.

If your attempting to use the RN2483 to send data to ‘the cloud’ outside of TTN then that is not a subject covered by this TTN forum.

1 Like

The keys are obtained when you register the device on the TTN Console.

Easiest would be to use the arduino environment on the stm32, because you get the libraries already written fro that.

If you do not want to use Arduino you are in for a lot of work. Best would then be to read the datasheet of the RN2483 as it lists all the commands you can send to the radio over the UART.

1 Like

Big THANK you for this, actually i have already seen your tutorial, first I’m going to answer your last question: yes I am going to send my data to the TTN.
Secondly, my question is if i make a library for the RN2483 and include it with my STM32L0 program like what you did with the arduino, is it going to configure and control the RN module? and if i translate the librarie u did for the arduino to an STM library is it going to work ?
my last question in what do i need the adresses ABP etc in the project exactly ?
Thank you so much.

Thank you so much for your response, i didnt actually understood the part where i have to list the commands to send it to the radio over the UART i have read the datasheet but they only show you how to program the RN through MPLAB which is not my case since i have to develop a script or a library with STM ( with the IAR IDE) so what i wanted to know if i try and translate the functions in the library like the one for the Arduino above is it going to work or is there another way ?

You are looking at the wrong document. If you go the the RN2483 page on the microchip website and select the documentation tab you will find the command reference which lists all the commands you need to send to the module and the responses.
However rather then starting from scratch I would look into one of the Arduino libraries for the device and adapt it to your device and development environment. That should save a lot of time.

Thank you so much for your response, that’s what i’m trying to do i have downloaded an arduino library for the RN2483 and know i’m trying to adapt it to my STM32 and what i wanted to know if this method is correct or not ? so i dont need to develop a script from scratch with those commands in the datasheet ?

No you don’t if you can make an existing library work.

1 Like

Okay thank you so much
besides i dont completely understand how with calling these functions from the library in my main of the STM is going to configure the RN and how could i for example turn on a LED attached to the RN through a line in the stm code ?

The module does not drive any leds by itself, you would need to add code to the library to do that.
An easier approach would be to use a 3v3 usb serial dongle and connect it to the tx of the RN module. That way you can observe its responses to the commands the STM sends. Use two usb serial modules or diodes linking RN tx and rx to one usb serial to observe communication both directions. The document I linked to should help you interpret the commands and responses.

Just curious, what study is this graduation project for?

1 Like

Okayy thank you so much this is so helpful i appreciate it :smiley:
sorry because i am asking a lot of questions but i have to ask you how could i add a function in the library to turn on a led ? with the stm i would use the gpio.write function but in this cas what could i do?
to answer your question it’s my final year graduation project to obtain my bachelor degree in the Applied License in Science and Technology : mention = EMBEDDED SYSTEM.

Add a library function that sends the required command to the RN module using the uart. Check the document I linked to for the command.

1 Like

Okay i will, thank you so much :pray: another question :sweat_smile: :sweat_smile: after writing the library and adding the key i get from the TTN then my RN will be linked to that network ? and then i can store whatever data transmitted to the RN IN

Where are you? Which university are you at?

1 Like

I’m from Tunisia and i study in the higher institute of computer science in Tunis.

The links that Jac gave you cover the information you need.

You connect your MCU to the RN2483A via their UARTs and the write some code to send the commands listed in the second document to the RN so that it is configured and can then send messages.

As electronics goes, this is pretty simple stuff and as suggested above, you could use the Arduino support for STM32.

Of if you are struggling with the electronics / coding, try out the tutorial from LoRaTracker using an off the shelf Arduino to get started and then convert what you have learnt to the STM32. This tutorial pretty much tells you everything you need.

If you choose to use a STM32, you may wish to switch to Arduino :wink:

If you are struggling to understand the details of LoRaWAN, then you need to consciously choose to learn this. One very good starting point would be the LoRaWAN academy or the more specific TTN docs.

Do you have a LoRaWAN gateway - the home page of TTN only shows one at Sidi Bou Said سيدي بو سعيد. A gateway will receive signals from your RN2483A and send them on to the TTN Network server. If the gateway is OK and you are close enough, it will work fine. If you have to debug anything, having access to a gateway that you can look at the logs is extremely helpful.

I’ve tried to strike a balance here between giving you enough pointers without actually doing your final project for you. Search the forum for any specific questions and if you can’t find the info you need, post a question - just please make it specific rather than a general “how do I connect component A to component B”. Good luck.

2 Likes