PicoCalc 9-AHRS Sensor over i2c => LSM9DS1TR 9DOF

After kind lead by @Katsumi decided to try my luck with his Basic compiler and locally procured sensor module. The module on sale with bargain price level, less than 14 euro piece.

Similar example with much less complicated module is here => Basic compiler MachiKania type P for PicoCalc - #20 by Katsumi

1 Like

My basic skill goes back to old SHARP 1401 handheld, so do not expect the miracles here.

First try to modify the existing code - not going smooth. Can not communicate with module over i2c. The reason can be the level of power, PicoCalc known troubles over i2c or the module it self.

Therefore decided to first find out about the module health status. For that I am using the RPIpad which have CM4 module inside and GPIO on hand…

Good news, the module is running good and i2c bus on RPI CM4 can communicate.

2 Likes

Still on RPI CM4 now have full working setup. Now just to copy initialization data and the rest to the Basic…

After several failures to get any reply from PicoCalc over I2c from LSM9DS1TR decided to replicate existing example with Basic compiler and MPU6050 => no luck…

First tested MPU6050 on 3v3 PicoCalc power, LED ok, run & error on I2c communication

Than made external 5V power for 6050, LED ok, again no luck

Than reduced the I2c speed 400 to 100, again no luck

Than load only MachiKania Basic compiler UF2 to avoid possible conflict with UF2 Loader, again no luck

After all that I am able to detect both boards over I2C on above RPI with CM4

Must be some hardware glitch… on Pico2w or Pico main board….or possible I2c problem with this version of Basic compiler….

Have more luck with MMBASIC

SetPin gp4, gp5, I2C
I2C open 100, 200

Print " 0 1 2 3 4 5 6 7 8 9 A B C D E F"
For y=0 To 7
Print Hex$(y,2);": “;
For x=0 To 15
addr = y*16+x
I2C write addr, 0, 1, &H00
If MM.I2C=0 Then
Print Hex$(addr,2);” ";
Else
Print "-- ";
EndIf
Next x
Print
Next y

I2C close

Discovered INI in Machi Kania Basic compiler….

After setting of proper I2c port, now have working example with MPU6050

MACHIKAP.INI

Specify I2C pins
Comment out for default settings
Note that I2C1 cannot be used for PicoCalc as it is used for keyboard
Valid values for I2CSDA: 0, 4, 8, 12, 16, 20, 24, 28 (I2C0)
I2CSDA: 2, 6, 10, 14, 18, 22, 26 (I2C1)
Valid values for I2CSCL: 1, 5, 9, 13, 17, 21, 25, 29 (I2C0)
I2CSCL: 3, 7, 11, 15, 19, 23, 27 (I2C1)

I2CSDA=4
I2CSCL=5

2 Likes