CAL_I2C Component Macro Connection problem

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
Sasi
Posts: 107
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 12:11 pm
Has thanked: 37 times
Been thanked: 14 times

Flowcode v10 CAL_I2C Component Macro Connection problem

Post by Sasi »

Hello!
I want to use the CAL_I2C component macro with a PIC24FJ256GA702 microcontroller.
In the Properties window, the SCA and SCL pins point to non-existent port.
If I change the I2C channel, the SCA and SCL port pins do not change.
PIC24FJ256GA702_I2C_CAL_CH1.jpg
PIC24FJ256GA702_I2C_CAL_CH1.jpg (58.91 KiB) Viewed 167 times
PIC24FJ256GA702_I2C_CAL_CH2.jpg
PIC24FJ256GA702_I2C_CAL_CH2.jpg (59.26 KiB) Viewed 167 times
Regards,
Sasi

mnfisher
Valued Contributor
Posts: 1518
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 726 times

Re: CAL_I2C Component Macro Connection problem

Post by mnfisher »

As a temporary fix:

If you double-click on the property name (e.g. SDA) you should get an 'Edit property' dialog box.

Click on 'writable' and then okay - and the property is now changeable...
sda.png
sda.png (48.34 KiB) Viewed 153 times
Martin

Sasi
Posts: 107
Joined: Wed Dec 02, 2020 12:11 pm
Has thanked: 37 times
Been thanked: 14 times

Re: CAL_I2C Component Macro Connection problem

Post by Sasi »

Hi Martin,

Thank you very much!
I didn't know about this option.
After setting the port pins I tried the CAL_I2C Macro. I found that the "Transaction_Initialise" command rotates the address value one place to the left. For example, if the address of the I2C device is 0x78, I have to enter 0x3C in the command to make it work properly.

Should I report this in a new bug report?.

Regards,
Sasi

mnfisher
Valued Contributor
Posts: 1518
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 726 times

Re: CAL_I2C Component Macro Connection problem

Post by mnfisher »

Hopefully the pins can be marked as changeable in the component.

The address is shifted left one bit when sent - bit 0 is then read/write (1/0). transaction initialise should take the unshifted address value - the address is 7bit and it's entered as bits 6..0 but sent as bits 7..1

Confusingly - addresses might be stated in either eight or seven bit form!

What device are you connecting to?

Martin

Sasi
Posts: 107
Joined: Wed Dec 02, 2020 12:11 pm
Has thanked: 37 times
Been thanked: 14 times

Flowcode v10 Re: CAL_I2C Component Macro Connection problem

Post by Sasi »

I was trying out an SSD1305 Display module with an I2C interface when I experienced this.
I used the SSD1306 Component Macro commands, but I overwrote the Display Initialization datas and used the CAL_I2C macro for this.
When I set 0x78 as the address in the "Transaction_Initialise" command, it sent the data to address 0xF0 and of course it didn't work.
When I set 0x3C, it sent the initialization data to address 0x78 and the display worked fine.
I have attached the test project.

Sasi
SSD1306_I2C Macro for SSD1305_I2C Display.fcfx
(19.69 KiB) Downloaded 10 times

mnfisher
Valued Contributor
Posts: 1518
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 138 times
Been thanked: 726 times

Re: CAL_I2C Component Macro Connection problem

Post by mnfisher »

0x3C is the correct i2c address (in 7 bit form) looks like the display component uses the 8 bit (pre-shifted) form. Consistency would be good!

The 7 bit form is much more usual - and personally I think life would be better if all components used this....

Great work on getting the display to work!

Martin

Post Reply