Page 1 of 1

FC8.2 PIC18LF67K40 I2C brocken

Posted: Wed Jun 19, 2019 3:00 am
by streammaster
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

Re: FC8.2 PIC18LF67K40 I2C brocken

Posted: Wed Jun 19, 2019 12:33 pm
by Benj
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.

Re: FC8.2 PIC18LF67K40 I2C brocken

Posted: Thu Jun 20, 2019 9:32 am
by streammaster
Hi Ben,

Thank you for your reply. Yes, if I use the software I2C then it is working correctly.
SM3 Soft i2c.PNG
(328.71 KiB) Downloaded 1116 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

Re: FC8.2 PIC18LF67K40 I2C brocken

Posted: Sun Aug 18, 2019 2:31 am
by streammaster
Hi Ben,

do you have any ETA on fixing this bug?

Regards,

Igor

Re: FC8.2 PIC18LF67K40 I2C brocken

Posted: Mon Aug 19, 2019 4:53 pm
by Benj
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.