Modbus Wake up RAK4631 via ModBus RS232

Please include the following information, in order for us to help you as effectively as possible.

  • What product do you wish to discuss? RAK4631, RAK3372, RAK11200, RAK11310, RAK11722?

RAK4631, RAK11722

  • What firmware are you using? (RUI3 or Arduino BSP or other IDE (e.g. STM32CubeIDE)?

RUI3

  • What firmware version? Can it be obtained with AT+VER=?

V 4.1.1

I want to know if it is possible to wake up rak4631 when it is in master mode using RS232 communication interfaces.

I am a little confused about this type of protocol, currently I must use a periodic timer to query the slave, but I want it to work so that when the slave is configured to automatically send data, the master in this mode listens without causing problems in tasks or loops.

For example, with the mangenic contact we can do this function by reading the relay status, would it be possible to do this by detecting the UART when it sends the data, wake up or if you have a better idea, welcome.

Thank you for your ideas and comments

I am not a Modbus expert, but from what I know, a Slave cannot initiate a data transfer. This is always requested from the Master.
There can be multiple Slaves on the bus, how would it avoid collisions if any Slave would start sending data whenever it wants.

Thank you Beegee for the explanation, this would be in the Modbus RTU case, but the RS232 case is a device.

I have been reading and I understand that I can wake up rak4631-R through the Uart1 port. Should something be enabled for it to work?

I have tried to wake up the node by sending data through Uart1 but I have not been able to do so. They remain asleep until the timer wakes them up.

Can you help me by showing me how to wake up a device by receiving data through the Uart1 port?

UART1 is disabled when Low Power Mode is enabled with api.system.lpm.set(1). The device will not wake up on received data.
There is no callback for data received on UART1. The only option is to poll the UART1 and check whether data is enable.

I don’t know a method that could do what you want to do.

Verifying other posts Carlos Woman indicates that it is possible but it is not clear to me

It will be possible what is indicated in the sent link

This connection diagram and what I need to do is that when Beevision 270 sends data through the RS232 port, the Rak4631-R wakes up, obtains the data and can process it to make decisions and send LNS.

verifying the RAK19007 has an RS232 input available to receive this data.

If I declared api.system.lpm.set(0) the device would never enter deep sleep mode and would always be waiting for when it receives UART1 data to process and send it?

Hi @amorales ,

It seems Carlos Woman is me :grin:

Based on the image you’ve shown, there is no Modbus involved in your BeeVision. Maybe it supports modbus but not on what you’ve shown.

@beegee told you already the approach. You have to poll the data form the UART. There is no asynchronous callback that you can use.

One more thing is why not initiate data collection using get# as mentioned in the image. You can sleep then wake up in specific interval then get the data.

You will need to have external RS232 board as well since we do not have off the shelf one. You can modify RS485 Modbus Sensor | TP8485E | RS485 Interface Microcontroller Module though but maybe having a dedicated RS232 is a quicker solution.

Hello Carlos,

Thank you for your prompt response,

I understand what you mean about the RS232 protocol, I could use an RS232 to TTL or UART converter.

image

I have been doing tests and this way I can get data through the UART1 port of the 19007 board.


image

Beevision only handles RS232 to send data, the software has an automatic trigger to send this data without using the get# command which I understand works for testing.

Using RUI3 it is possible to make a code that is always waiting for data via UART1 and then process the data and send it to LNS.

I have been working with RUI3 based on events and it is a problem because going to sleep and only waking up at your predetermined time does not guarantee that I do not lose the data.

Do you have any example that can help me?

I do not think there is a direct way using RUI3.

Few things I can think off:

  1. Have a different pin to check RX line then trigger the wake up, then the UART capturing of bytes will be done on the callback. Not sure if the fan out of the Beevision is enough.
  2. Have an external MCU then use the RAK module only for transmission via AT commands.
  3. Use a low level code on nRF52840 that will initialize the RX pin first as interrupt source then on wake up, immediately switch to UART RX. I am guessing on this one. I am not even sure if this works.

I understand what you mean and we handle the data with a circular buffer.

If you can see that RUI3 is getting the data via UART1 port. Then process it as you would with any other data.

Or use a FIFO like the one from a door sensor to process the data.

I’m thinking but I’m not sure it works.