Any program run this way will not be able to access Bela’s audio, analog and digital I/Os while another Bela program is running.

Just a bit confused by this bit. Does that exclude the I2C bus then?

I was just think how cool this is and setting it up this project to read a few analog inputs/switches and then just having SuperCollider receiving OSC and making sound.

Is that possible?

Many thanks Simon

    simonb Bela’s audio, analog and digital I/Os

    these are all handled by a "Bela program" and there can only be one of these running at any time, which will take control over all of those, processing them at audio sampling rate and with low latency. "digital I/O" here refers to the 16 GPIOs handled directly by the Bela core, which are those highlighted in the pin diagram for your board. This does not include devices connected over other digital busses e.g.: I2C, UART, SPI, which can he handled by any program running on the board. You can still access the GPIOs that are not managed by Bela and are not otherwise used by Bela using the Gpio class and integrating it within this same program. See more details here.

    simonb I was just think how cool this is and setting it up this project to read a few analog inputs/switches and then just having SuperCollider receiving OSC and making sound.

    If you are processing audio via scsynth, you'll have to process all of those also via scsynth, there are dedicated ugens to do that: AnalogIn, DigitalIn, DigitalOut, DigitalIO. You can then use sendReply() if you want to send a snapshot of the input values back to sclang.

    simonb Do you have one of those buy me a coffee type things?

    No thanks, I don't drink coffee. Just tell all your friends about the good experience you've had here.

    21 days later

    @simonb I updated the library , would you be able to help me test this by repeating the step here with the latest files from the repo and using Bela's latest dev branch?

    10 months later

    Hi @giuliomoro

    I am just going through the steps above to make this Library on another Bela board.

    Just run into this Error. Any ideas how to fix it? Many thanks
    Simon

    Building Wire.cpp...
    Makefile:510: recipe for target '/root/Bela/projects/Adafruit_TSC2007-Linux-master/build/Wire.o' failed
    Build finished
    In file Wire.cpp: no member named 'readRaw' in 'I2c' column: 21, line: 78
    In file Wire.cpp: no member named 'writeRaw' in 'I2c' column: 14, line: 82
    In file Wire.cpp: no member named 'readRaw' in 'I2c' column: 20, line: 92
    /root/Bela/projects/Adafruit_TSC2007-Linux-master/Wire.cpp:78:21: error: no member named 'readRaw' in 'I2c'
    int ret = master->readRaw(address, (i2c_char_t*)buf, 1, !stopBit);

    /root/Bela/projects/Adafruit_TSC2007-Linux-master/Wire.cpp:82:14: error: no member named 'writeRaw' in 'I2c'
            if (master->writeRaw(_address, (i2c_char_t *) txBuffer, usedTxBuffer, !stopBit) == usedTxBuffer) return 0;
                ~~~~~~  ^
    /root/Bela/projects/Adafruit_TSC2007-Linux-master/Wire.cpp:92:20: error: no member named 'readRaw' in 'I2c'
            int ret = master->readRaw(address, buf, len, !stopBit) == len ? 0 : -1;
                      ~~~~~~  ^
    3 errors generated.
    make: *** [/root/Bela/projects/Adafruit_TSC2007-Linux-master/build/Wire.o] Error 1
    
    
    
    
    `
    `

    You need to udpate the Bela core code to the dev branch on the board where you build this.

    6 days later

    Thanks!

    I am back on this on a OG Bela not mini. Updated to this.

    Version details
    Image:
    v0.3.8h, 5 January 2023

    Core code:
    Last updated on '2 Oct 2024 23:02:48 '
    from file 'Bela-dev'
    via 'update_board'
    Update was successful
    Git desc: 'e43b8abe-dirty'

    Downloaded the the Adafruit_TSC2007-Linux-master from above. Wired up everything correctly but now I get the same message as above.

    Build finished
    Running project ...
    Successful to do ioctl for 1 bytes on I2C at addr 72 with flags 1: 1
    Couldn't find touch controller

    Then tried this.

    i2cdetect -y -r 1

    And get this.

    '
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00:


    --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- --


    40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    '

    Any ideas what to try next?

    Thank you.

    Best wishes

    Simon

    I don't know why that doesn't work. I suspect that this may fix it, can you try?

    diff --git a/Wire.cpp b/Wire.cpp
    index b64bae7..3d9e1f2 100644
    --- a/Wire.cpp
    +++ b/Wire.cpp
    @@ -76,7 +76,9 @@ uint8_t arduino::MbedI2C::endTransmission(bool stopBit) {
                    // we are scanning, return 0 if the addresed device responds with an ACK
                    char buf[1];
                    int ret = master->readRaw(_address, (i2c_char_t*)buf, 1, !stopBit);
    -               return ret;
    +               if(1 == ret)
    +                       return 0;
    +               else return -1;
            }
            #endif
            if (master->writeRaw(_address, (i2c_char_t *) txBuffer, usedTxBuffer, !stopBit) == usedTxBuffer) return 0;

    Thanks will try when I have a bit more time on it.

    5 days later

    Hi @giuliomoro

    I am trying to solve this issue. Still the same.... Where do I put that code? Sorry its not obvious to me.

    Running this version and hitting the same issue as discussed above.

    Any help much appreciated.

    Thanks

    Simon

    image:
    v0.3.8h, 5 January 2023

    Core code:
    Last updated on '15 Oct 2024 13:29:08 '
    from file 'Bela-dev'
    via 'update_board'
    Update was successful
    Git desc: 'e43b8abe-dirty'

      simonb Where do I put that code? Sorry its not obvious to me.

      In the Wire.cpp file around line 79 change return ret .

        giuliomoro
        Thanks! did you mean this?

        
        if (1 == ret) {
            return 0;
        } else {
            return -1;
        }

        That compiles ok. Then I get a endless stream of these messages and the LED on the 2007 board flashes like the screen is being continually touched. Not actually sure whats different with this Bela and the mini it was working on before. Would I be better to just get another mini?

        Successful to do ioctl for 1 bytes on I2C at addr 72 with flags 0: 1
        Successful to do ioctl for 2 bytes on I2C at addr 72 with flags 1: 1
        Successful to do ioctl for 1 bytes on I2C at addr 72 with flags 0: 1
        Successful to do ioctl for 2 bytes on I2C at addr 72 with flags 1: 1
        Successful to do ioctl for 1 bytes on I2C at addr 72 with flags 0: 1
        Successful to do ioctl for 2 bytes on I2C at addr 72 with flags 1: 1
        Successful to do ioctl for 1 bytes on I2C at addr 72 with flags 0: 1
        Successful to do ioctl for 2 bytes on I2C at addr 72 with flags 1: 1
        Successful to do ioctl for 1 bytes on I2C at addr 72 with flags 0: 1

        Does that make sense?

          simonb did you mean this

          Yes. The stream of messages may be a good sign: does the display work?

          What's different is that the rest of the code may have changed. The best bet is to use the same sd card as the mini abd it should work fine. Then you can flash the emmc from the sd card.

          Ah thanks

          No something is not quite right on this one...

          I used to obviously get the osc messages printing out and all was good.

          As I mentioned the light to show that the screen is being touched continually flashes when the bela code runs and displays the stream of messages above.

          unfortunately my bela mini is buried deep in the original instrument and doesn't have an SD card so it would be much more preferable to get this version running. It seems close.

          Yes it does have an sd card. Mini don't work without sd card. Do you know when it was that it was working for you?

          Is it possible that there's something wrong with the wiring of this one?

          Hi,

          So taken the card out from the mini.... And it looks like the same problem but harder to debug as on that one it was set up to start the 2007 program in the background. So it crashes the whole system I think.
          The wiring is the same as here..

          And I am seeing this so I presume that means the i2C connection has been made.

          root@bela ~/Bela# i2cdetect -y -r 1
          0 1 2 3 4 5 6 7 8 9 a b c d e f
          00:


          --
          10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
          50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
          70: -- -- -- -- -- -- -- --

          If you only have the display connected to that i2c bus then that reading lools ok. What message do you get when running the code with the sd card that works on the mini?

          With the bela mini SD card I seem to be getting lots of instability. The IDE keeps crashing..

          I get this.. but its unusable as I it seems to freeze up.

          Successful to do ioctl for 2 bytes on I2C at addr 72 with flags 1: 1
          Bela stopped
          Bela has disconnected. Any changes you make will not be saved. Check your USB connection and reboot Bela.
          -- Logs begin at Thu 2016-11-03 17:16:43 UTC. --Successful to do ioctl for 2 bytes on I2C at addr 72 with flags 1: 1

          Bela has disconnected. Any changes you make will not be saved. Check your USB connection and reboot Bela.