I2C for PIC24F32KA301 not working

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
RTJNair
Posts: 12
Joined: Sun Nov 09, 2014 5:53 pm
Location: Oman/India
Has thanked: 5 times
Been thanked: 2 times
Contact:

I2C for PIC24F32KA301 not working

Post by RTJNair »

My application (FC chart attached below) was to link an AMG8833 to a 3.3V PIC24F32KA301 on I2C but couldn't make it work on any of the two hardware channels. Neither the software nor hardware (tried both channels) options were also working. However, the 1-sec led was flashing correctly if I disable the "TransmitByte with the ACK feedback" block under AMG_INIT macro. The SCL pin were giving some strange frequencies, some times 960Hz, 2 KHz and was erratic.

I have also tried the CAL file "PIC16BIT_CAL_I2C" with the following correction by Benj.

#define MX_I2C_HW_BAUD ((MX_CLK_SPEED / MX_CLKS_PER_INST) / MX_I2C_BAUD_X) - 2

Also, the "internals.c" with

#define MX_CLKS_PER_INST 2

Appreciate any help.

RTJ Nair
AMG_test0.fcfx
(18.57 KiB) Downloaded 226 times
Grid-EYE SPECIFICATIONS(Reference).pdf
(410.04 KiB) Downloaded 209 times
PIC24F32KA301.pdf
(2.52 MiB) Downloaded 224 times

RTJNair
Posts: 12
Joined: Sun Nov 09, 2014 5:53 pm
Location: Oman/India
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: I2C for PIC24F32KA301 not working

Post by RTJNair »

Benj/Leigh,

Somehow, I was able to get the HARDWARE channel 1 (B8/9) working with the thermal sensor AMG8833. Since I intend to use an I2C SSD1306 Oled/component also, can you please help me out in getting the I2C HARDWARE channel-2 (B2/15) working for this application. I ran out of ideas to get this working.

If I select channel-2 or software in the I2C Master, channel-1 communication stops. The clk pin for both doesn't produce pulses for all options (custom/100/400KHz). The 1 sec flasher works fine.

Only hardware channel-1 works at 100 or 400KHz or 115200 Hz.

I need it very badly and appreciate your help.

Thanks in advance.
RTJ Nair

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

Re: I2C for PIC24F32KA301 not working

Post by Benj »

Hello,

Please can you post your latest Flowcode project for us to have a look at what the problem might be.

RTJNair
Posts: 12
Joined: Sun Nov 09, 2014 5:53 pm
Location: Oman/India
Has thanked: 5 times
Been thanked: 2 times
Contact:

Re: I2C for PIC24F32KA301 not working

Post by RTJNair »

Hi Benj,

Sorry for the delay. I was on a short holiday.

Thanks for the reply.

As requested, the modified program is attached below.

Got it working by connecting both the I2C devices ie; OLED and AMG sensor to channel 1 (hardware) with the common clock speed of 400KHz.

Can you please look into the reason why channel 2 is not working (both hardware as well as software).

Thanks in advance
AMG_test1.fcfx
(21.47 KiB) Downloaded 235 times
RTJ Nair

Post Reply