Unable to connect to RAK4630 for Serial output

So here’s a strange one:

I can no longer connect to my RAK4630 serial port when it is running.

If I double press the reset button then a new COM port is created on my Windows machine and I can upload my programs without issue, however as soon as the program has been loaded and the device resets there is no longer a COM port opened by windows.

Has anyone else experienced this?

It’s rather a large issue since we are planning on using the serial connection to monitor certain aspects of the device when it is running.

I’d try uploading a simple starter sketch as it may be that something in the code it has on it at present has disabled the serial output …

Yes, I experience your symptoms on an all too regular basis. Very frustrating, wasting a lot of time fighting it. Will contribute what I can… but no solution that I’ve found so far.

1 Like

@nmcc this is the simplest I can come up with:

#include <Arduino.h>
#include <SX126x-RAK4630.h>

void setup() 
{
  Serial.begin(115200);
  delay(100);
}

void loop() 
{
  Serial.println("loop");
  delay(5000);
}

in my platformio.ini file I have

monitor_speed = 115200
upload_speed = 115200

I can sometimes connect to the Serial port, but there’s never any output to it.

I’ve not done much bare metal nRF52840 but if it’s anything like AVR or Atmel SAM, serial speed vs clocks vs MHz can throw up some single digit % jitter so I’d try dialling it down to 9600 as pretty much anything should be able to sync at that speed.

I’d also try reseating the module on it’s base board and try a different computer as well.

It was all working fine last week. No changes since, but now it just doesn’t work.

All the examples I’ve seen have a small loop around the delay:

time_t timeout = millis();
// On nRF52840 the USB serial is not available immediately

while (!Serial)
{
	if ((millis() - timeout) < 5000)
	{
		delay(100);
		digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
	}
	else
	{
		break;
	}
}

while I don’t think this will solve your problem, it might prevent some issues especially since you’re using the Serial output.

The loop is only there because // On nRF52840 the USB serial is not available immediately. It waits until the nRF52 has initialized it’s internal USB and was put there to avoid loosing output on USB serial.

For the sudden connection problems that you report, we will have to look into it. However we didn’t update the BSP or bootloader for a long time, so I am not sure if it is related to something there.
Did you do any other updates? Updated Arduino IDE? Using the Arduino IDE V2.x Beta? Changed your USB cables?

I was working yesterday on some of my private projects and where uploading code all day to my RAK4631 without any problems.

@beegee I actually mis-reported, I still cannot get any serial connection, and I’ve changed nothing in the code. It’s actually the same with multiple boards, so I’m guessing that it’s something environmental.

The only difference is that I updated the Nordic nRF52 platform to 8.2.0. Maybe I’ll try going back to 8.1.0

@billr
Are you using PlatformIO?

@billr
I can confirm for PlatformIO

Nordic nRF52 platform version 8.2.0 has problems with USB. After uploading a sketch, the USB is not connecting anymore.

Nordic nRF52 platform version 8.1.0 works fine.

I will try to find out what the problem is.

Workaround until then,
in platformio.ini set platform to 8.1.0 like this:

[env:wiscore_rak4631]
platform = [email protected]
board = wiscore_rak4631
framework = arduino

That’s exactly what I did @beegee, and everything is once again working as expected.

I had wanted to spend the weekend trying to put together an event driven version of our solution, but sadly without the feedback I needed (from the board, via the Serial port) it was somewhat difficult to continue down that path … maybe next weekend :rofl:

It is such a shame that RAK staff take time out at the weekends and insist on sleeping :wink:

It’s a bit frustrating that a borked release from someone like Nordic gets out and that there isn’t a notification / recall mechanism in PlatformIO. I’ve turned off Arduino IDE boards & libraries notifications as the update list is still buggy and updates have broken so many test projects. I have several virtual machines setup with different combinations of development software so I can try again on my last known good setup.

yeah @nmcc you’ve completely misunderstood my message … I was talking about not getting feedback from my RAK4630, not from anyone on here.

I’ve gone ahead and modified that post though, just to be certain that nobody else misunderstands the intent.

1 Like

@billr
No worries, I had no problem with your message. I was just busy all weekend with testing some new secret RAK weapon that will make developing low power applications much easier :sunglasses:

Just imagine RAK4630 flashed with Arduino IDE (or PlatformIO) created firmware I measure 30mA sleep current.
With the secret weapon I am getting 6mA sleep current with the same functionality.

I could tell you what it is, but then I have to shoot you. :gun:

@beegee as much as I don’t want to get shot any time soon (or ever in fact), that does sound rather cool :sunglasses:

The problem that I need to overcome at the moment is battery power! We don’t want to build a large enclosure, but the 1000mAh batteries just don’t last more than about 12 hours when using the GPS modules, and then the solar panels required to keep those batteries charged need to be quite large.

And now amount of low power drain in deep sleep is going to help with that :sob:

@nmcc

I have several virtual machines setup with different combinations of development software so I can try again on my last known good setup.

It’s been a consideration here too, I can run VMs on my Synology NAS box and even though that has RAM up to the wazzoo, the processors just can’t cope with more than a couple running at a time … though having said that, I’ve only used Windows VMs on it so far, I really ought to fire up a LINUX VM and see how it copes with that.

It’s possible to run them on your desktop - and you only need to run them on demand. Whilst I have a couple of ESXi servers for a mix of full time and as required machines, most of the safety net of VMs are run on my main machine.

So I have a collection of VM’s that are known good for a particular hardware release / project - many of which are compressed as they rarely need to be spun up. Then some that are used to test out a particular combination of development tools. And a fair few get created to debug issues where I need to figure out if it’s my code, library code, vendor code or the tools.

Once I’m happy that something is good to go, only then does it get applied to my main development environment. Still doesn’t stop the occasional hiccup, but mostly keeps me rolling!

You can run the VM on your desktop - and you only need to run them on demand.

Would be better stated as It’s possible to run them on your desktop, because I actually cannot: due to the requirements of another piece of software, I’ve had to turn off onboard virtualisation.

A few more months before it will be released unfortunately. Still a lot of work to do before it is ready to use.