Mar 28, 2014
05:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 28, 2014
05:33 PM
Hi.
Today i tried to connect the MPU6050 breakout board from Sparkfun with XMC4500. I tried to adapt the code on I2C001_Example1 with the pins P0.5 and P0.11 and every time i test it, it always enters the interrupt IIC_Prot_Int_Handler (protocol specific interrupt) and stays there. I have one question: if I'm able to get this interrupt, it means that I have the I2C setup correctly configured and I'm only messing up with the data to write, or the I2C setup can be wrong?
Today i tried to connect the MPU6050 breakout board from Sparkfun with XMC4500. I tried to adapt the code on I2C001_Example1 with the pins P0.5 and P0.11 and every time i test it, it always enters the interrupt IIC_Prot_Int_Handler (protocol specific interrupt) and stays there. I have one question: if I'm able to get this interrupt, it means that I have the I2C setup correctly configured and I'm only messing up with the data to write, or the I2C setup can be wrong?
- Tags:
- IFX
7 Replies
Not applicable
Apr 01, 2014
01:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 01, 2014
01:48 AM
Apr 01, 2014
10:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 01, 2014
10:47 AM
Hi Zain,
I looked at that post and, in fact, that is my base code to do my program. The problem is that i don't know if i have anything wrong with my circuit or it's only with my code.
So if i get an protocol specific interrupt, that means that my circuit is correct and the comunication is working (my code is wrong) or I can't assume that?
I looked at that post and, in fact, that is my base code to do my program. The problem is that i don't know if i have anything wrong with my circuit or it's only with my code.
So if i get an protocol specific interrupt, that means that my circuit is correct and the comunication is working (my code is wrong) or I can't assume that?
Not applicable
Apr 02, 2014
01:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 02, 2014
01:13 AM
Hi,
The protocol specific interrupt occurs in case of a non-acknowledge (PSR.NACK =1). While, the TCSR.TDV flag remains set, but no further transmission will take place.
Why don't you try to step through the code and observe those status flags eg. PSR.NACK & TCSR.TDV? So that you would know when the non-acknowledge happens.
BTW, did you check the baud rate?
BR,
Zain
The protocol specific interrupt occurs in case of a non-acknowledge (PSR.NACK =1). While, the TCSR.TDV flag remains set, but no further transmission will take place.
Why don't you try to step through the code and observe those status flags eg. PSR.NACK & TCSR.TDV? So that you would know when the non-acknowledge happens.
BTW, did you check the baud rate?
BR,
Zain
Apr 02, 2014
11:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 02, 2014
11:42 AM
My code is the following:
I2C001_DataType sData;
sData.Data1.TDF_Type = I2C_TDF_MStart;
sData.Data1.Data = (0x68 | I2C_WRITE);
while(!I2C001_WriteData(&I2C001_Handle0,&sData));
//Next write the reggister address that i want to read
sData.Data1.TDF_Type = I2C_TDF_MTxData;
sData.Data1.Data = 0x68;
while(!I2C001_WriteData(&I2C001_Handle0,&sData));
sData.Data1.TDF_Type = I2C_TDF_MStop;
sData.Data1.Data = ubyteFF;
while(!I2C001_WriteData(&I2C001_Handle0,&sData));
The non-acknowledge happens after the first WriteData. The baud rate is 400 kbits/sec.
I2C001_DataType sData;
sData.Data1.TDF_Type = I2C_TDF_MStart;
sData.Data1.Data = (0x68 | I2C_WRITE);
while(!I2C001_WriteData(&I2C001_Handle0,&sData));
//Next write the reggister address that i want to read
sData.Data1.TDF_Type = I2C_TDF_MTxData;
sData.Data1.Data = 0x68;
while(!I2C001_WriteData(&I2C001_Handle0,&sData));
sData.Data1.TDF_Type = I2C_TDF_MStop;
sData.Data1.Data = ubyteFF;
while(!I2C001_WriteData(&I2C001_Handle0,&sData));
The non-acknowledge happens after the first WriteData. The baud rate is 400 kbits/sec.
Not applicable
Apr 03, 2014
02:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 03, 2014
02:30 AM
Hi,
The 1st transmission is the master initiating the start condition with the slave. Are you able to see the toggling on SDA & SCL during stepping (Both should stay "H" during idle)? Can you confirm the slave address "0x68"?
The 1st transmission is the master initiating the start condition with the slave. Are you able to see the toggling on SDA & SCL during stepping (Both should stay "H" during idle)? Can you confirm the slave address "0x68"?
Apr 04, 2014
05:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 04, 2014
05:40 AM
Yes, the master slave is correct. Both SDA and SCL stay H during idle, I will see with a Oscilloscope if the signals match what i want, i dont see any other reason to this error.
Thank you for your help.
Thank you for your help.
Not applicable
Apr 06, 2014
09:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 06, 2014
09:02 PM
Hi,
Do you mean that you can see the correct toggling signals from the oscilloscope but you still receive non-acknowledge interrupt? It seems that the slave can't recognize the data you sent. Sorry, I have no idea as well:(
Why not try to disable all protocol specific interrupts by un-checking all the interrupts listed in the "Interrupt Configuration" tab (re-confirm the PCR register setting in debug mode) and see whether you can step further?
BR,
Zain
Do you mean that you can see the correct toggling signals from the oscilloscope but you still receive non-acknowledge interrupt? It seems that the slave can't recognize the data you sent. Sorry, I have no idea as well:(
Why not try to disable all protocol specific interrupts by un-checking all the interrupts listed in the "Interrupt Configuration" tab (re-confirm the PCR register setting in debug mode) and see whether you can step further?
BR,
Zain