Page 1 of 1
CAL_I2C Component Macro Connection problem
Posted: Wed May 28, 2025 3:33 pm
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 (58.91 KiB) Viewed 178 times

- PIC24FJ256GA702_I2C_CAL_CH2.jpg (59.26 KiB) Viewed 178 times
Regards,
Sasi
Re: CAL_I2C Component Macro Connection problem
Posted: Wed May 28, 2025 8:03 pm
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 (48.34 KiB) Viewed 164 times
Martin
Re: CAL_I2C Component Macro Connection problem
Posted: Thu May 29, 2025 7:46 am
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
Re: CAL_I2C Component Macro Connection problem
Posted: Thu May 29, 2025 8:10 am
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
Re: CAL_I2C Component Macro Connection problem
Posted: Thu May 29, 2025 9:03 am
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
Re: CAL_I2C Component Macro Connection problem
Posted: Thu May 29, 2025 10:57 am
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