RAK11720 Modbus data cannot read through Serial1

hi
iam charlet,iam using RAK11720 module soldered on RAK3172 breakout board and updating the firmware via TTL connector.i want to read modbus data through Serial1,but iam not receiving any response from the Serial1.whether it is due to RAK3172 Breakout board is not compatible with RAK11720 Serial1? or it is due to the modbus library iam using?

iam using MODBUSRTUMASTER Library,

Welcome to the forum @charlet_priscilla

The RAK11720 is pin compatible with the RAK3172 and the UART pins are at the same position.

I do not know this specific ModBusRTUMaster library, but I was able to setup a ModBus RTU master with this example code on all of the WisDuo modules (RAK3172, RAK11720, RAK4630)

RUI3-Best-Practice ModBus
It uses an adapted version of the Modbus-Master-Slave-for-Arduino library (not published in Arduino Library Manager I think).

RUI3_ModbusRtu.cpp
RUI3_ModbusRtu.h

Thank you for the response sir,

I think I collapsed the uart in rak11720.not I cannot give at command and cannot update the firmware.can you send me the updated bootloader for rak11720

Thanks,
Charlet.

I don’t have separate bootloader for the RAK11720.
Use the RAK11720_latest_final.hex, that should include everything.
You need JLink or RAKDAP1 to flash it.

For RAKDAP1, read this post

Hi sir,
I tried the firmware recovery method to update the boot loader,but i faced the below error

now i want to try the other method to update the boot loader,can i update the hex file with pyocd in the command terminal(with jlink)?

Thank you,
charlet.

For the recovery method, did you follow the RESET RAK11720 BOARD!!! that is shown in the log? Sometimes you need to try several times to catch the right time.

If you have a Jlink, why not use JFlash application to flash the HEX file? I never tried pyocd with a Jlink adapter. I use it only with DAPlink adapters.

Hi sir,
sorry for the late response,
i just tried with another RAK11720 Module,with the new one i got the modbus data with below code.

#include <ModbusRTUMaster.h>

uint16_t holdingRegisters[5];
ModbusRTUMaster modbus(Serial1,45); // serial port, driver enable pin for rs-485 (optional)

void setup() {
Serial.begin(9600);
delay(1000);
Serial1.begin(4800);
delay(1000);
modbus.begin(9600); // baud rate, config (optional)
delay(1000);
}
int i;
void loop() {
modbus.writeMultipleHoldingRegisters(1, 1, holdingRegisters, 5); // slave id, starting data address, unsigned 16 bit integer array of holding register values, number of holding registers to write
modbus.readHoldingRegisters(1, 1, holdingRegisters, 5);

Serial.print("Register “);
Serial.print(“1”);
Serial.print(”: ");
Serial.println(holdingRegisters[1]);
delay(1000);
}

after sometime i just modified the firmware and try to upload,it shows the same error,

RAK Apollo3 Serial Bootloader
Script version: 0.0.1

Failed to enter bootload phase…
after that i tried with AT+BOOT,Firmware updated only 70% then failed with the same error.
now AT command no response,also i cannot upload the firmware.i really dont know what is the issue…

Power cycle the RAK11720 and it should come up in bootloader mode. Then try again to flash the firmware.

I already tried the same.what will be the cause of this issue…is it related to begin the Serial1?

could be the issue.
Power up the board, connect a serial terminal with 9600 baud and then send AT+BOOT to the board. It should go into bootloader mode and set the baudrate to 115200 for the firmware update.

I already send AT+BOOT,but still it failed to upload at 70% of uploading state.i think my module is still in a boot mode(if iam not wrong).

i send AT+BOOT at Baud 9600,no response

Boot mode is automatically in 115200 baud. Whatever you set in your application.

Did you try different USB port? Different cable?

Is this a RAK11720 stamp module or is it a RAK11722 WisBlock Core module?

If it is a stamp module and you are using a USB-TTL adapter, can you try a different adapter.

Last option, if you have a JLink or DAPLink, you can try to flash the original RUI3 AT command firmware through the SWD interface of the module.

yes sir,i found this is the issue.now i try to upload the bootloader using jlink.
still facing the issue below

iam following this steps…

++
is there any possiblity to erase the last updated firmware using jlink commander?

I never work with the commandline with Jlink.
In JFlash you have the option for a chip erase.
Should be possible with the commander as well. You just have to read the docs for it.

Btw, after answering a similar question (same screenshot)

Your error message says “Cannot connect to J-Link”
That is a problem with your J-Link adapter, not with the RAK11720.
We cannot help with problems using the Segger J-Link adapter or J-Flash application. You can connect Segger directly for this problem

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.