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.

        Those disconnections may be due to the Bela program using slightly more.cpu on this board or maybe you have somethinf in there that depends on the state of the analog or digital inputs and so misbehaves with nothing connected?

        Press the stop button in the ide in the brief moments it is available. That should stop.the Bela program and stop the disconnections

        Thanks for all this help!

        Cool, OK so using bela mini card... I stopped Adafruit_TSC2007-OSC running in the background with.....

        systemctl stop Adafruit_TSC2007-OSC

        I found an earlier version and it seems to work.... and I think I can build up from there. code below....

        Still a bit confused/worried why I can't build it up like before. I would love to understand whats going on a bit more so I can debug in the future.

        I guess its some interaction between the library, the Dev version, firmware etc. Seems like only you can fix it so sorry about that.

        
        #include "Adafruit_TSC2007.h"
        #include <libraries/OscSender/OscSender.h>
        
        // hostAddress should be "localhost" if sending to another application on Bela
        // or 192.168.7.1 or 192.168.6.1 if sending to a port on the host computer
        
        // this works and sends to computer when program running as a service
        //const char* hostAddress = "192.168.7.1";
        
        // when I try to change to this it still runs but has no effect on the same pd patch. This time on the Bela
        const char* hostAddress = "localhost";
        //const char* hostAddress = "192.168.7.1";
        //int hostPort = 7562;
        
        int hostPort = 57120; // because supercollider is annoying
        unsigned int sleepMs = 50; // sleep time between reads
        
        
        int main()
        {
        	Adafruit_TSC2007 touch;
        	OscSender oscSender(hostPort, hostAddress);
        	if (!touch.begin()) {
        		fprintf(stderr, "Couldn't find touch controller\n");
        		return 1;
        	}
        	printf("Found touch controller\n");
        	printf("Sending to %s:%d\n", hostAddress, hostPort);
        	while(1)
        	{
        		printf("made it to the while loop\n");
        		uint16_t x, y, z1, z2;
        		if(touch.read_touch(&x, &y, &z1, &z2)) {
        			oscSender.newMessage("/tsc");
        			oscSender.add(x).add(y).send();
        			printf("sending_osc from the if loop\n");
        		}
        		usleep(sleepMs * 1000);
        	}
        	return 0;
        }

        Anyway this is printing nicely so hopefully I am on the path to getting it all running again on this other board.

        Thanks