Quite a while ago I stopped working on SmallBASIC PiGPIO, a plugin for SmallBASIC on the Raspberry PI to access the GPIO pins, because I realized that the plugin was not compatible with the Raspberry Pi 5. Since quite a while I’m working on version 2 of SmallBASIC PiGPIO which comes with a lot of improvements and compatibility with the Pi 5. In principle it can even be used on other Linux Single Board Computers. If you are interested to try it out, you can find the documentation at SmallBASIC PiGPIO 2.
Great news but I don’t see a speed setting for I2C(?)
Hi Tinine, on the Raspberry Pi the I2C speed is set up in a system config file and it is applied at boot up of the system. Please have a look here for configuring the I2C speed: Change the Clock Speed | Raspberry Pi I2C Clock Stretching Fixes | Adafruit Learning System. Valid I2C speeds are 100kHz (default), 400kHz, 1MHz. According to I²C - Wikipedia some higher speeds are possible. So far I tried a SSD1306 display with 1Mhz and it worked fine.
I have installed small basic on a Pi 5 & Pi 3b+ all installed ok on both. But when I run a pre-configured program e.g led flash both Pi’s give the following error
Unit gpio.sbu not found or wrong version
Can you help please ?
Hi romba, this error message is displayed when the library was not found. If you have installed the library as Tinine posted and it is not working please execute make clean. Then ./configure and post the output here. Next make and post the output, too.
How do you start the basic programs? Can you please post the command including the parameters.
Thank you for your help. Started afresh from make clean on Pi 3b and all working correctly on simple ‘examples’ . (LED and switches) . Looking forward to trying I2c.
Will re-look at Pi 5 tomorrow. I’m sure I will have done something wrong so will re-load
Enjoying the experience !!
Awesome ![]()
Looking forward to the RPi5 report ![]()
Now making good progress on Pi5. Testing out graphics and all working fine. Still reading manual for further progress. Working now with I2C, ssd16x oled and the demo progs are working with this display. The I2C examples given have preconfigured libraries via import …. I would like to drive a PCF8574 are there BASIC i2c commands that I can use to read/write to this device (and other devices)? Not discovered in manual yet so sorry if I’ve missed it.
OK, found it !!! Can now connect and write & read …..
import i2c
Print “Connect to PCF8574”
pcf = i2c.Open(0x20, “/dev/i2c-1”)
i2c.write(pcf, 0xaa)
Really nice to hear, that everything is working so far.
Thank you for the feedback.
Exciting stuff
![]()
Please keep us updated with progress ![]()
OK Back to playing again!
A couple of obsercvation whilst using pigpio2 on Raspberry pi5
1/ GPIO Trigger : If i do trigger (20,100,1) i get invalid input (trigger) expected 1-2 arguments.
2/ Trigger (20,50) always gives a 110 uS pulse irrespective of trigger duration setting. Just for fun I set the duration to 0 and I get an inverted pulse of the same duration.
Is this a pi5 problem only?
Thank you for the bug report. I’ll have a look the next days.
Have you already tried the new RaspberryPi OS (Trixie)? I haven’t tested it yet. I hope everthing still works.
Thanks, not a show stopper and just observations.
I haven’t tried Trixie as yet, will load up another sd card and give it a try next week.
I fixed the two bugs. I don’t have an oscilloscope. When increasing the pulse length, I can see that the LED flashes brighter (as expected). But I can’t measure the pulse length. Maybe the implementation is too slow and the 50µs is too optimistic.
Thankyou !! Fix works perfectly. FYI on my Raspberry pi 5 running bookworm. Trigger(4,
1,1) i.e duration 1 = 60uS, duration 5 = 70uS, duration 20 = 80uS, duration 50 = 110uS, duration 100 = 160uS, duration 200 = 250uS . All of which are fine by me!!! The Voltage level of trigger works too. I loaded Trixie on a new SD Card. It runs smallbasic ok (not extensive testing) but when I load pigpio2 unfortunately it gives gpio.sbu not found. I did a search for gpio.* from root and it is indeed nowhere on the system.
I noted that libfreetype6-dev was substituted with libfreetype-dev. No idea if important !
Thank you for all your support
GPIO access was not possible on Raspberry Pi OS Trixi because Debian finally update libgpiod to version 2. Version 2 introduces a complete new API. I fixed all the broken parts and added some new features like simultaneous read and write of multiple pins. You can now set pullup or pulldown resistor or disable it. There are some minor changes to the functions. Maybe you need to fix some parts in your code.
Great! Thankyou J7M, just tried a quick led flash on a Pi400 running Trixie and all good. Will do further tests over next few days.
Some observations using PIGPIO2
In Examples and ST7789 or ST7789_2 both run correctly from Pi startup but if I re-run the program everytime I get LIB:ST7789 error setting RST,DC,BL pin to output. Coming right out of Smallbasic and in again workrs correctly again but first time only.
In Examples again BMP280 . In the program no pin is allocated to MISO - so I connected to Pin21 . Program now runs BUT Address of device always 0x00. CSB should be ‘0’ (pin24) because running SPI this is always high. If I put it on 0v programs runs BUT device address is different everytime I run it. Data output incorrect but is output in 5 lines. Maybe because CSB incorrect.
More peripherals to check in due course.
