I'm getting a RED LED starting my program. It only happens when I have a UDP object exposed

ON powerup or reset, I get the following LED pattern:
White
Green
Cyan slow flash
Cyan quick flash (sometimes)
Red flash
repeat

I had a global UDP object, which I thought might be causing problems (maybe on class initialization it causes problems?). It was being initialized in setup().

Then I moved it into something like this:

static UDP Udp;
static bool first = true;
if (first)
{
    UDP.begin(port);
    first = false;
}

I still have the same problems.

I’ve made a different UDP program work just fine (from another post about this kind of problem, where I was seeing my own packets).

What does the Red LED flashing mean? If I comment out all the UDP stuff it works great. If I write something simple with UDP it works great. It is only when I add the UDP stuff to my existing code (which works without the UDP stuff), I end up with this cycle of (apparent) resets.

Am I running out of RAM or something like that? Or stack space?

Thanks!

HI Again,

The red flashes are panic codes recently added to core firmware. You should see SOS flashed out (three short, three long, three short) followed by a number of flashes that you count and then SOS again. The number of flashes tells you the fault. I went to look for the list here in the forum because I know it was posted but I found them in the source quicker:

def_panic_codes(Faults,RGB_COLOR_RED,HardFault) // 1
def_panic_codes(Faults,RGB_COLOR_RED,NMIFault)  // 2
def_panic_codes(Faults,RGB_COLOR_RED,MemManage)
def_panic_codes(Faults,RGB_COLOR_RED,BusFault)
def_panic_codes(Faults,RGB_COLOR_RED,UsageFault)

def_panic_codes(Cloud,RGB_COLOR_RED,InvalidLenth)

def_panic_codes(System,RGB_COLOR_RED,Exit)
def_panic_codes(System,RGB_COLOR_RED,OutOfHeap)

def_panic_codes(System,RGB_COLOR_RED,SPIOverRun)

def_panic_codes(Softare,RGB_COLOR_RED,AssertionFailure)
def_panic_codes(Softare,RGB_COLOR_RED,InvalidCase)

Sometimes there is a fault during a fault and the whole panic code does not come out.

All that said, the most common reason would be that your program is out of RAM.

@bko thanks.

I figured the problem out. I was simply using too much RAM.

I’ve reduced my footprint and all is well.

I even have my UDP broadcasts going out properly.

Thanks for all your help.

Regards,

mgessnr

1 Like