BelaPlatform/bela-image-builder

When/how should Bela start at boot?

Closed this issue · 4 comments

I added a line at the end of /opt/Bela/bela_init.sh:

sleep $SLEEPTIME; /root/Bela/projects/basic/basic

Now, if SLEEPTIME=2 (seconds) or less, then the program actually starts but the PRU hangs during a DAC_WAIT_FOR_FINISH:

  423 :                   : .macro DAC_WAIT_FOR_FINISH
  424 :                   :  LOOP:
  425 :                   :      LBBO r27, reg_spi_addr, SPI_CH0STAT, 4
  426 :                   :      QBBC LOOP, r27, 0
  427 :                   : .endm

so probably something is wrong in booting up the SPI peripheral?

If SLEEPTIME=4 then the program starts fine. I hear sound 19 seconds after I power up the board (after a graceful shutdown).
If SLEEPTIME=3 then it depends. Once it started and worked fine, the other time it started but stopped after half a second (PRU hanged again at that point).

try merging the dtbo into the dtb to fix this?

After b(h)a(c)king the overlays inside the main dtb file, then I can have /root/Bela/projects/basic/basic at the bottom of /opt/Bela/init_bela.sh (after uncommenting the overlays) and with NO $SLEEPTIME and then I hear sound 16 seconds after powering up the board.

oh sweet, can you put the dtb in boot in the this repo? I'll see if I can get systemd to start it earlier.