Running the sinetone example on the BBAI

As of 28 Jul 2021
asciicast
For the edits in the code part, kindly visit this link and follow the git diff's.

Pre-req:

Instructions

  • Clone the Bela repo locally on your BBAI using (preferrably in /root/.)
    git clone https://github.com/giuliomoro/Bela-dhruva Bela
    
  • Switch to the BBAI-support using git checkout BBAI-support inside the repo you just cloned.

  • (Not needed anymore, this has been taken care of in PRU code) After this, first and foremost you will need to use the devmem2 tool which can be found in /resources/bin. This helps configure the clock, without this step things can go wrong later on. (This will soon be done automatically from the PRU code, but till then this will be necessary.)
    sudo ./devmem2 0x4A005550 w 0x7000002
    
  • (Not needed anymore, this has been taken care of in PRU code)
    git checkout build_pru
    
  • (Not needed anymore, this has been taken care of in PRU code)Now copy this tempfolder where you want outside the Bela repo and then navigate into it.
    Now, follow the README from here which you will also find inside the tempfolder.

  • (Not needed anymore, this has been taken care of in PRU code)Once the PRU code is built, then you can come back to the Bela repo you had cloned earlier.
    Now, switch to the ai-testing branch using
    git checkout ai-testing
    
  • Finally, you should create a projects folder in /root/Bela/. and then copy your choice of example (here I show sinetone) to it. Then, use the command below to build and run the example.
    make PROJECT=sinetone CL=-v run BELA_USE_DEFINE=BELA_USE_POLL
    
  • If all goes well, then you should see something like:
Not using McASP->PRU irq
Using Non-McASP IRQ embedded PRU firmware
Stopping PRU1_1
Loading firmware into PRU1_1: /lib/firmware/am57xx-pru1_1-fw symlinked from /root/testBela/build/pru/pru_rtaudio.out
Starting PRU1_1
_________________Audio Thread!

and also be able to hear a sinetone of 440Hz frequency on the AUDIO OUTPUT of the BELA Cape.

  • To stop, simply do a ctrl+C.

Contingencies

  • run ldconfig /usr/xenomai/lib/ if you get any libcobalt related error
  • Is you get any i2d errors, then I suggest using pull up resistors on the I2C pins. (P_19 and 9_20)
  • you may need to revert this commit git revert bf14f5172e25b0f3b1f9fc0b7ef573b8fa9d4786