BelaPlatform / bela-image-builder

Scripts to build a Bela image from scratch
MIT License
37 stars 16 forks source link

When/how should Bela start at boot? #34

Closed giuliomoro closed 7 years ago

giuliomoro commented 7 years ago

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).

giuliomoro commented 7 years ago

try merging the dtbo into the dtb to fix this?

giuliomoro commented 7 years ago

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.

LBDonovan commented 7 years ago

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.

giuliomoro commented 7 years ago

that's here now https://github.com/BelaPlatform/Bela/pull/285