How to prevent RGB LED going off during SOS blinks?


#1

Howdy

So, I notice that since the Bluz needs to sleep often, to save power … the SOS aka red RGB LED signals no longer work properly. While the ...---... is being blinked, something else is fighting with the signal, turning the LEDs off periodically. Thus, one cannot count the flashes to get an error code – let alone really perceive that there’s an, “SOS” in there somewhere.

I’m pretty sure this is caused by something in power management. The system needs to be told not to sleep while we’re sending our SOS.

I’ve spent literally a couple hours trying to nail this down. Embarrassingly as ever, I failed.

What am I missing?

Happy hacking! :slight_smile:


#2

The RGB LED shouldn’t go off during an SOS blink. Are you saying it starts to flash SOS in Red and then turns off at some point?


#3

@eric … well, I guess the best way I could describe it would be as if the usual status pulses (say, green slow) and the SOS blinks are being logically AND’d together – with the output colour being whatever was last set.

EDIT: Maybe as if two different threads are fighting over the same LEDs.

I’m pretty sure that the non-SOS input to said AND gate is whatever the LED was doing before the error. So, if it was not being turned on or off elsewhere, then the problem wouldn’t show. Hence, the more sparsely spaced slow cyan blinking for example would likely not show the fault quite so obviously as green fast pulse, as is the case here – simply because there’s so much more time between those cyan pulses. (I’m not certain of this. It just looks to me like that would be the case.)

The SOS in this case is being triggered by a call I’m making from platform layer code, thusly …

err_code = [something other than zero];
APP_ERROR_CHECK(err_code);

… which occurs within the following code, when testTimer.start()'s internal call to app_timer_create() fails with error code 8 …

void loop() {
  static bool once = true;
  if (once && BLE.getState() == BLE_CONNECTED) {
    testTimer.start();
    once = false;
  }
}

Hmmm … do something else for a bit, while I go back to release firmware and just check that it’s not something I’ve introduced … … …

… OK. Thanks for waiting.

It’s still the same. I checked out bluzDK/BluzDK-firmware (develop branch), added my rtc_timer.cpp/h and user/applications/rtc_timer/rtc_timer.cpp, built with, make PLATFORM=bluz APP=rtc_timer. Oh and I’m flashing locally, using the ST-Link.