Coexistence of serial reception and anti-buzy with loop function

LoraP2Pjusinki_jikancopy.ino (5.4 KB)

I thought it would be derived from the linked story and made it a separate thread.

A different arudino program than the one in the link
(main change: psend when serial is received)

and I got a lot of bouncing errors in the IDE.

Answer (if the application does loop() without delay and keeps the MCU busy, it may affect the firmware download)

So I added a wait time because of this

 delay(10);//dame ms
it seems to be unable to get serial reception.
(I also tried with a thread like commented out, but no serial reception)

api.system.sleep.all(100);//ms>>baundratio era- generate
then the program works fine and
baundraito occurred.

Should I handle this outside of the loop function as much as possible?
If you have a sample, please let me know.

With all your errors in the serial connection, I would first

  • check for stable power supply of the RAK3172, is it a custom PCB?
  • check your UART-to-USB converter, maybe try another one
  • check the USB cable itself, try another one

beegee thanks for the reply.

Please check the stable power supply of
1RAK3172. Is it a custom PCB ?
2Check the UART-USB converter, try another converter
3Check the USB cable itself, try another cable

Since this is happening, I’m guessing 1 or 2 are not available.
I have tried several cable switches.

With the arudino code you disclosed
//delay(10);//dame ms
then serial is received and psend is sent.

Finally found time to look into the code you shared.

You are interfering with (and maybe even blocking) the Serial port handling of RUI3 when you use your serialThread()'** or when you use **Serial.available()** and **serial_read_line()`. That’s most likely the reason why you have problems with the firmware upload.

If you need the Serial port to send commands to your device you should use a custom AT command to receive the commands.

In custom_at.cpp you can find an examples how I implement custom AT commands.

Another thing, in recv_cb() you are doing way too many things. The RX and TX callbacks are called from the LoRa handler, you should use them e.g. to create a flag that you handle in the loop() or in a timer callback function. If you spend too much time in the callbacks, the whole flow of the underlying RUI3 state machine is influenced.

Thanks beegee for the reply.

When I do this serial receive process with custom,
AT commands are less or no response.
(I have tried making the serial receive process a timer, a thread, etc.)
As long as I am doing the serial receive process, I can’t do AT commands for RUI3?
Is it not possible to do this?

You can do Serial.print/printf/println/write without problems.
But when you start intercepting incoming data from Serial, the RUI3 AT commands are not going where they should go.

As I said, if I need to send something to the device over Serial, I use custom AT commands. If I need to send something from the device, I just send it.

I stopped receiving custom serials and the phenomenon has not occurred for 3 days so far.

Previous proprietary serial reception has been dropped. Put a new custom FW.
[xxx_LoraP2Pjusinki_wintablet4.ino|attachment] (upload://8I2XKQWGb5LdVTwJyeluuu4sHVy.ino) (4.7 KB)

bouncing errors in the IDE occurred.
AT commands are not accepted. The application crashes and the UART stops working?
I can receive serial from RAK3127.
When AT commands are not accepted, it becomes dysfunctional.

There is no attachment with your code. Can you re-upload or share otherwise.

xxx_LoraP2Pjusinki_wintablet4.ino (4.7 KB)

There was a secret part and I raised it again. It seems to have disappeared then.