Pi PICO No Hardware I2C on Channel 1 or Channel 2

Any bugs you encounter with Flowcode should be discussed here.
LeighM
Valued Contributor
Posts: 401
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 70 times
Been thanked: 217 times

Re: Pi PICO No Hardware I2C on Channel 1 or Channel 2

Post by LeighM »

Hi,
The issue is that on Pico (and other families, such as STM32, ESP32, Raspberry Pi)
the I2C does not work at the low level "Start, Byte, Stop" (as it does on PIC etc)
You need to use the Transaction API that use data buffers.

ps. You can also use the Transaction API with PIC, the CAL does the low level stuff for you. :D

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: Pi PICO No Hardware I2C on Channel 1 or Channel 2

Post by chipfryer27 »

Hi Leigh

Hmm, I seem to remember that.....

Regards

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: Pi PICO No Hardware I2C on Channel 1 or Channel 2

Post by chipfryer27 »

Hi Leigh

Using Transaction on Ch1

Transaction on Ch1.jpg
Transaction on Ch1.jpg (65.38 KiB) Viewed 205 times

In a previous post (that I probably linked to) it did mention transactions :oops:

Regards

jay_dee
Posts: 132
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 47 times
Been thanked: 31 times

Re: Pi PICO No Hardware I2C on Channel 1 or Channel 2

Post by jay_dee »

Hi Guys,
So if I have a User Macro that I used to read a sensor with PICs
My process for PIC was
Initialise Macro
Start, Tranmit device Address, Transmit register address, transmit Data_Byte, stop.

For PICO, ESP32 etc
I use the Transaction_Initialise Macro
then should I just do three transaction_writes?
Transaction_Write Device Address, Transaction_Write Register Address, Transaction_Write Data_Byte

Are all other macros listed are redundant, other than any Transaction_xxx macros ?
Thanks, John.

LeighM
Valued Contributor
Posts: 401
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 70 times
Been thanked: 217 times

Re: Pi PICO No Hardware I2C on Channel 1 or Channel 2

Post by LeighM »

Create a byte Buffer[8]
Call Transaction_Initialise (with the device address as a parameter)
Setup the Buffer data (Buffer[0] = register address, Buffer[1] = data)
Call Transaction_Write(Buffer, 2)
Are all other macros listed are redundant, other than any Transaction_xxx macros ?
For the Pico, yes

Post Reply