Clocks and LoraWAN


I have recently posted how I had configured the mkrwan to have a rtc, wdt and edge based interrupts.

I have OSCULP32K routed via GCLK1 (divide 4) to WDT, RTC and EIC and the processor configured into deep sleep until the RTC wakes it back up.

However, now that I have also wired in the LoraWAN stuff, it is unable to connect, model.begin(EU868) fails. I have tried various things, different combinations of code order to see if I can get it to work, but I am not having any success. I have had a read through the mkrwan.h and associated files and I can’t seem to find anything that gives an sign posts to the cause.

I think this because, if I run in full power, it works, the only bit of code that is different is shown below:

    DEBUG = true;
    if (!Serial) delayMicroseconds(2500*1000);
else {
    DEBUG = false;

So I think it is to do with the serial comms, but I can’t figure out what it can be. Serial.begin(115200) is to enable the serial monitor, nothing more, or at least I think that is the case.
Any ideas?

The lora module uses the SERCOM4 perihperal. Make sure the SERCOM4 gets the same clock as before, as all the timming are referenced towards the "factory" clock settings. If that's not the case you need to either reconfigure SERCOM4 registers to use the 32K clock or supply SERCOM4 with a different clock, provided SERCOM4 was set to use GCLK1 as per "factory" setting - I haven't checked that out. Hope that points you in the right direction.

Fantastic. Many thanks for your explanation

That explains it, I was using GCLK1 for my rtc / wdt configuration.

It’s interesting that some of the libraries provided by Arduino use these same clock controllers.

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