Problem with the I2C component in PIC32MX370F512H MCU

Moderator: Benj

Post Reply
Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

Hi,

I would like to ask help because the I2C Master component not working with PIC32MX370F512H chip if I use the hardware channel setup.
Nothing happen on the I2C signal ports.

The software channel is working. ( I note the SCL signal 522 kHz instead of 400 kHz in this case. )

I tried the "I2C Master" and "cal I2C" components. The two components behave the same.

I use the UART component too in this project and it is working correctly.

Best Regards,

Lagoda

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

Hello Ben,

Thanks for the reply.
I may have misrepresented the problem.
The I2C internal peripheral does not work in the MCU.
But I tried what you suggested.
The situation has not improved.

Would you check again?
Lagoda

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

Addition to the previous ones:

I also tested the I2C Master component with a PIC18F67K40 MCU, in this case only the software channel works too.

I also tested the I2C Master component with a PIC24FJ1024GB610 MCU. In this case, the code cannot be compiled if you want to use hardware channel 3. Channels 1 and 2 works, but the clock speed is approximately 47kHz when SCL = 100kHz is set. Approximately 125kHz for SCL = 400kHz, 333kHz for SCL = 1MHz.

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: Problem with the I2C component in PIC32MX370F512H MCU

Post by Benj »

Sorry reply was for a different topic :oops:

Thanks I'll have a look into the problem for you.

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

Hello Ben,

That would be very good! :)
The most important thing for me would be to be able to use the I2C peripherals of the PIC32MX370 MCU.
I noticed that channel 2 is not initialized by the component macro.
Something happens to channel 1 during initialization, but it can only send START. (I tested it with the "Cal I2C" component macro.) I'll watch it again tomorrow (Thursday) morning, but channel 2 is certainly wrong.

Best Regards,
Lagoda

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

:cry: :cry: :cry:

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: Problem with the I2C component in PIC32MX370F512H MCU

Post by Benj »

Hello,

Sorry for the delay. I think I've spotted the problem, at least with channel 2 not being initialised and while I'm fixing that I'll see if I can find anything that is causing the problems for channel 1.

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: Problem with the I2C component in PIC32MX370F512H MCU

Post by Benj »

Hello,

I've now pushed an update to the update system.

Hopefully it improves things for you with the I2C hardware channels but let me know how you get on.

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

Hello Ben!

Thank you very much for your help. :D
Both channels seem to work. I tested it with the "Cal I2C" component macro.
Master and Servant are talking to each other. I only checked with an oscilloscope.
The SCL frequency is 370 kHz. Can you set it to 400 kHz?

Best Regards,

Lagoda

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: Problem with the I2C component in PIC32MX370F512H MCU

Post by Benj »

Hello,

Excellent that's great progress. I've now pushed another change to hopefully better work out the baud rate.

Let me know how you get on.

Lagoda
Posts: 170
Joined: Fri Jul 15, 2016 9:51 pm
Has thanked: 69 times
Been thanked: 61 times
Contact:

Re: Problem with the I2C component in PIC32MX370F512H MCU

Post by Lagoda »

Hello,

Sorry I made a mistake, the SCL now 370 kHz. :oops:
The previous SCL setting was good.
Sorry, once again.

Please reset the previous baud rate.
Thanks,
Lagoda

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: Problem with the I2C component in PIC32MX370F512H MCU

Post by Benj »

Hi Lagoda,

No problem I've rolled it back for you. Thanks for letting me know.

Post Reply