FC8.2 PIC18LF67K40 I2C brocken

Moderator: Benj

streammaster
Posts: 78
Joined: Mon Jul 31, 2017 11:14 am
Has thanked: 7 times
Been thanked: 13 times
Contact:

FC8.2 PIC18LF67K40 I2C brocken

Postby streammaster » Wed Jun 19, 2019 3:00 am

Hi Ben,
I discovered that the I2C is not working when compiled to the target hardware. The compiler is MPLAB XC8 Pro. As soon as any of the cal macro control are issued to the bus the main loop will hang.
I'm using the I2c code using CAL which works successfully with some other FC8 project and processor.
I also tried to use the component (LIS3LV) and the effect is the same (it hangs without doing anything on the bus). I believe something is wrong with the PIC configuration.
The logic analyser shows no activity on the physical I2C bus so it looks that actual PIC hardware is not properly initialised.
I hope it is not a big issue for you to fix this as it is stopping me to continue to work.
I'm running on 18LF67K40 internal 64MHz clock and so far ADC and UART are working with this PIC and FC8.2 ok.

Regards,
Igor

User avatar
Benj
Matrix Staff
Posts: 14226
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4363 times
Been thanked: 4096 times
Contact:

Re: FC8.2 PIC18LF67K40 I2C brocken

Postby Benj » Wed Jun 19, 2019 12:33 pm

Hi Igor,

Can you post a demo program that shows the lock up so we can investigate. Can you also confirm if the lock up is resolved if you switch to a software I2C channel.

streammaster
Posts: 78
Joined: Mon Jul 31, 2017 11:14 am
Has thanked: 7 times
Been thanked: 13 times
Contact:

Re: FC8.2 PIC18LF67K40 I2C brocken

Postby streammaster » Thu Jun 20, 2019 9:32 am

Hi Ben,

Thank you for your reply. Yes, if I use the software I2C then it is working correctly.
SM3 Soft i2c.PNG
SM3 Soft i2c.PNG (328.72 KiB) Viewed 448 times


However, if I use Channel1 the i2C bus SDA and SCL stays high and no activity. The loop hangs at trying to execute first Cal command in "i2c_Read_sensors" macro (initialise is actually passing).
I attached my test program as you requested. Currently, the i2c is set to software emulation which is only working on the target.
The Accelerometer is the slave device which I'm talking to. It is LIS3DH Accelerometer. I'm accessing the "Who I Am" register (0x0F) and device address is 0x18. I'm reading a single byte and I'm getting the expected value "51" (0x33). The demo FC project is attached.

Regards,

Igor
Attachments
PIC18LF67K40 basic config I2c only test.fcfx
(27.48 KiB) Downloaded 16 times

streammaster
Posts: 78
Joined: Mon Jul 31, 2017 11:14 am
Has thanked: 7 times
Been thanked: 13 times
Contact:

Re: FC8.2 PIC18LF67K40 I2C brocken

Postby streammaster » Sun Aug 18, 2019 2:31 am

Hi Ben,

do you have any ETA on fixing this bug?

Regards,

Igor
These users thanked the author streammaster for the post:
Benj (Mon Aug 19, 2019 4:53 pm)
Rating: 5.26%
 

User avatar
Benj
Matrix Staff
Posts: 14226
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4363 times
Been thanked: 4096 times
Contact:

Re: FC8.2 PIC18LF67K40 I2C brocken

Postby Benj » Mon Aug 19, 2019 4:53 pm

Hi Igor,

Many thanks for chasing this one up. I have looked in the definition file and the chip was missing the remappable I2C support required by the hardware pins. This has now been added and pushed to the v8 update system so hopefully will now work correctly.

Let me know how you get on.