KillerBerthier
Posts: 29
Joined: Thu May 05, 2016 4:28 pm

System crash when running a program during boot

Tue Jul 05, 2016 7:18 pm

I wrote a program for my Pi3-based guitar pedalboard and it works great at the moment.
Now I try to run it when the Pi starts up. I tried several solutions with /etc/init.d and /etc/rc.local and various “Required-Start” conditions.
In all cases, the program starts and run correctly, but after a few seconds, during the black screen before the desktop appears, the system freezes (not always, but most of the times), the ACT led stops blinking. I cannot even log with SSH.

Is there any reason for this? My program uses a lot of GPIO stuff (SPI, I2C, DMA…) and a USB soundcard via the ALSA drivers. It works fine when run manually. The system is a regular Raspbian Jessie updated today.
And when the freeze happens, how can I disable the program launch, given that the crash prevents me to edit any configuration file?

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: System crash when running a program during boot

Tue Jul 05, 2016 7:24 pm

If it works sometimes, it sounds like a timing issue.
Try adding sleep 30 before your program into /etc/rc.local

KillerBerthier
Posts: 29
Joined: Thu May 05, 2016 4:28 pm

Re: System crash when running a program during boot

Tue Jul 05, 2016 8:34 pm

Thanks. Indeed, it works much better by adding a “sleep 15” in front of the command, making the program run just before the desktop appears. However I would prefer not to rely on a random timing. Is there anything I could test in the program before going further? The system shouldn’t crash like this, I must have missed something important.

KillerBerthier
Posts: 29
Joined: Thu May 05, 2016 4:28 pm

Re: System crash when running a program during boot

Thu Jul 07, 2016 12:22 pm

Finally I loaded the card on another Linux computer and removed the offending autorun file.
I also found out why the system froze. I used DMA channel #0 for my LED PWM. However it is used by the system, as stated by joan in this enlightening thread. For some reason it didn’t cause any conflict before so I haven’t suspected the DMA here. I changed the channel to 4 and everything now works wonderfully.

Return to “General discussion”