FORUM TOPIC · READ ONLY

PIC32. Problems with I2C.

PIC32. Problems with I2C.

Forum : bug reports

4 message(s) · archive en lecture seule

uwlu
My hard- and software: PIC32MX360F512L 80MHz, matlab 2008a.



Hi Lubin,

I'm trying to communicate with a HMC5843 sensor. It's a I2C device. For this task I have built a very simple model. I want to use I2C 1 with 400 kHz. The reload value for the BRG can be calculated or taken from the table according the PIC32MX Family Reference Manual, Section 24(DS61116D) p.32. I take the I2CxBRG value for 40 MHz PBCLK from the table 24-1. It is 0x030 or 48 in decimal. I put then this value into the I2C Master Block and get Fscl = 661.157 kHz. Why? Shouldn't be a value about 400 kHz? It's my first problem. The next problem occurs if I try to compilate the model. I get an error message like:

Error using ==> genMakefileAndBuild at 1138



and in Command Window



magnet_field_sensor.c: In function `magnet_field_sensor_step':

magnet_field_sensor.c:48: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:55: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:58: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:67: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:70: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:79: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:82: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:91: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:94: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:104: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:111: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:114: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:124: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:127: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:134: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:137: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:148: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:151: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:170: error: union has no member named `MI2C1IF'

magnet_field_sensor.c:173: error: union has no member named `MI2C1IF'

gmake: *** [magnet_field_sensor.o] Error 1



Could you please give me an advise what I'm doing wrong?



Regards

Oliver

Pièce jointe : magnet_field_sensor.mdl

uwlu

Re: PIC32. Problems with I2C.

Hi Lubin,

Did you overlook my post? I'm still waiting for your help.



Regards

Oliver
Bobes

Re: PIC32. Problems with I2C.

I dont think I can help you, but you should probably also post your c-file.

Kind regards Josef
LubinKerhuel

Re: PIC32. Problems with I2C.

Hi Olivier,



I should do some more test on I2C with PIC32. I have no project using this target yet and errors may remains.

I'll try to have a look on it, but I may not be able to do it in the next two or three weeks.



Lubin