Is Pi GPIO Support Dead?

I’d be interested in hearing whether you get that working with Xojo’s SerialConnection. Also note the Pi has a second UART; not sure which one Xojo will talk to, if either.

I have done several projects requiring a serial connection (connection with PIC microcontroller) and I use an FTDI USB-Serial adapter each time.

The advantage is that they work with all OS (Windows, Mac, Linux, PI) and you don’t need to install anything. Just use a ‘SERIAL CONNECTION’ in Xojo and voila. You can develop and test your project directly from the Mac and transfer it to the PI once everything is working. You can also replace the PI with a new model without having to worry about which library is or is not compatible… You find models for each use with USB to serial or TTL connection in 5V or 3.3V and these adapters are very reliable, I have never had a defective in more than 10 years of use.

P.S. This is just my example, I have no agreement with FTDI :slight_smile:

Thanks… I’ll check that out. This is the fallback option.

But I already got the pins 8/10 working as the primary serial port and was able to use SerialConnection to establish a connection with those. I’ll detail how when I get the rest of this working. But as suspected it was a stupid setting in the pi that had to be flipped to enable those pins to be the primary serial port.

But with that so far I’m only able to verify that’s it’s working with a hardware feedback loop where I connect pins 8 and 10 together. When I do that I am seeing back on 10 whatever I send on 8. And this works both in picocom and in my xojo app. No problem. So that part is working fine.

I suspect the issues I’m haivng now are just the nitty gritty of establishing the connection with the module. And I’m reaching out to Longan now for help on that. I had it working previously when attached to an arduino. So I’m probably very close.

1 Like

You can select which one xojo uses with the SerialDevice class.
You need to make sure that bluetooth (uses hardware uart by default) is not enabled (see config.txt documentation rpi)

GPIO, i’d recommend to use libgpiod (native linux gpio) you can use it with the Shell class in xojo:
gpioget, gpioset, gpioinfo etc. read more here:
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/

1 Like

Yes it works fine once I got past the pi roadblocks. Using basically this tutorial and modifying the code example to send and recieve data:

http://documentation.xojo.com/getting_started/creating_more_apps/connecting_to_a_serial_device.html

The +++ is what I sent the device over serial.

And the “ENTER INTO SETTING MODE” is what was returned.

So that works although I am still having other issues with the module that I’m waiting to hear back from Longan on.

But yeah DerkJ is right that I had to do several steps to get it to work. First was to turn on the pin8/10 uart in raspi-config. But turn off it echoing the console.

To disable the system service that initialises the modem I had to do:

sudo systemctl disable hciuart

And then to the /boot/config.txt I had to add:

# Disable Bluetooth
dtoverlay=disable-bt

After that as it says here: Raspberry Pi Documentation - Configuration

/dev/ttyAMA0 will be the primary uart and accessable by SerialConnection in xojo.

So that took a day to figure out. Now I just have to get the module working right but that’s not a xojo problem. Thanks everyone for the help.

4 Likes

I just wanted to post the success story here. Using the above methods I was able to talk to the can bus module using SerialControl over pins 8/10. The module protocol is pretty simple, there are AT commands to set up the module and then when in data mode each packet is 14 bytes and is passed on to the can bus. The module translates between Serial and the Can Bus in both directions. So if you request a status from an actuator the 14 byte response will immediatly come back.

While I’m not using pigpio for serial, I will be using it for other inputs and outputs. For example limit switches to let me know when a motor hits the edge of it’s range. Or possibly to control a servo or two. But for this project I’m going to try to use the actuator motors only. These actuators are amazing. They are heavy duity and have a lot of torque. I have various sizes of them. Shown in the photo is the RMD-X8 which is pretty heafty. It’s the kind of motor used in the Boston Dynamics robot dog (but not the same brand). I think there are 12 in that robot. And in my application all my motors can communicate with the module and therefore the pi over a single daisychained 2 wire cable. The baud rate on the can bus side is 1000k, on the serial side right now I’m using 57600, but I’ll probably up that to 115200 if it doesn’t produce any errors.

As for is the pi fast enough, issues with non-real time, and all that type of stuff. None of that will be an issue for me. The pi doesn’t have to control these motors like you would a servo. They’re smart motors so you just tell them what to do and they do it. If anything my app will have to wait for them to finish before sending the next command. And for my particular application speed isn’t critical. A few millisecond delay here or there won’t change the outcome, as long as I can trigger the motors all at the same time for cooporative movements, but that’s a function of the motors.

FYI in the photo the motor isn’t attached to power yet. The pi is in a 10 inch touch screen case.

I am building this project for my youtube channel. If it’s not too off topic when I get this project completed
I will share the link here. My hope is to do all the coding in xojo. This way I’ll have a nice touch screen GUI. Thanks again!

10 Likes

I always love seeing Xojo control hardware, thanks for sharing. It’s my main use for Xojo, but always PC-based; haven’t yet had a compelling reason to use a Pi instead, but that may happen someday.

1 Like

what is your YouTube channel?
Or will you announce here when you upload the video?

Sure. I didn’t want to just self promote because I came here for honest support. But my channel is Nerdtronic

Basically it started as mostly a resin 3d printer channel. But from the beginning I planned to not only cover printing and printers but to USE printing to make cool projects. And this pi robotic project is one of those. I plan to do a lot of robotic projects over the rest of the year, but will also have some less complicated projects in there also.

Last year I also released a 3d printer helper app called Bulge Buster which was written in Xojo. But I haven’t done much support on it as it doesn’t pay and I don’t have that much free time.

2 Likes

Thanks! I subscribed

I subscribed too!

1 Like