Attachments are accessible only for community members.
Not applicable
Dec 09, 2013
10:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 09, 2013
10:49 AM
Hi all,
I am new with the XMC4500 microcontrollers family and with DAVE3; until today I successfully developed some simple applications with DAVE for XMC4500 Relax Kit.
Now I am experiencing some relevant difficulties with an application that uses I2C to periodically read data from an STM's LSM303DLHC three-axis magnetometer + accelerometer mounted on a small breakout board from Pololu.
Nonetheless I have correctly configured the I2C001 App (v1.0.26) in DAVE and made and double checked the required connections, I don't see any signal coming out from the configured I2C pins (they always stay at 3.3V except for a brief short pulse on the SCL line during the initialization).
I attach the zip archive of the DAVE project and I hope someone can help me with some useful hint.
Thank you in advance.
I am new with the XMC4500 microcontrollers family and with DAVE3; until today I successfully developed some simple applications with DAVE for XMC4500 Relax Kit.
Now I am experiencing some relevant difficulties with an application that uses I2C to periodically read data from an STM's LSM303DLHC three-axis magnetometer + accelerometer mounted on a small breakout board from Pololu.
Nonetheless I have correctly configured the I2C001 App (v1.0.26) in DAVE and made and double checked the required connections, I don't see any signal coming out from the configured I2C pins (they always stay at 3.3V except for a brief short pulse on the SCL line during the initialization).
I attach the zip archive of the DAVE project and I hope someone can help me with some useful hint.
Thank you in advance.
4 Replies
Not applicable
Dec 10, 2013
02:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 10, 2013
02:46 AM
Hi Francesco,
Firstly, I think you may already aware of the followings:
1) XMC4500 Relax Kit is using XMC4500-F100x1024;
2) Both SDA & SCL are two bidirectional open-drain lines, need to be pulled "H" externally.
Secondly, perhaps you can try to put write/read data commands inside the while loop in order to see the SDA/SCL continuous toggling.
FYI, I am able to see the toggling by adapting "I2C001_Example1" to Relax Kit using P0.5 & P0.11.
BR,
Zain
Firstly, I think you may already aware of the followings:
1) XMC4500 Relax Kit is using XMC4500-F100x1024;
2) Both SDA & SCL are two bidirectional open-drain lines, need to be pulled "H" externally.
Secondly, perhaps you can try to put write/read data commands inside the while loop in order to see the SDA/SCL continuous toggling.
FYI, I am able to see the toggling by adapting "I2C001_Example1" to Relax Kit using P0.5 & P0.11.
BR,
Zain
Attachments are accessible only for community members.
Not applicable
Dec 11, 2013
04:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 11, 2013
04:31 AM
Hi Zain,
thank you for your hints; I was already aware of the details about the I2C protocol. In my case the SDA and SCL lines are pulled up by two resistors on the Pololu's breakout board.
I managed to see something coming out from I2C pins (P0.5 and P0.11) adapting the I2C001_Example1 demo project to my I2C peripheral.
However, the communication between the XMC4500 and the accelerometer works well only when I make a step by step run for functions I2C001_WriteData and I2C001_ReadData (I see the correct signals on SDA and SCL with an oscilloscope); when I launch the program in free run (no pause between the single write/read operations) the I2C signals disappear and do not appear even when I pause the program and make it advance again step by step.
Debugging my code I have found that the problem is with these lines of code in the do-while loop of I2C001_WriteData in I2C001.c:
if(I2CRegs->PSR_IICMode & USIC_CH_PSR_IICMode_WTDF_Msk)
{
Result = (bool)FALSE;
break;
}
If I run the program in free run, after the transmission of few bytes on the I2C bus, the WTDF bit comes true and this causes the function to abort returning Result = false.
Looking for WTDF in the XMC4500 Family Reference Manual I found that the WTDF bit is set to true in the following conditions:
• TDF slave code in master mode (PSR.WTDF)
• TDF master code in slave mode (PSR.WTDF)
• Reserved TDF code found (PSR.WDTF)
• Start condition code during a running frame in master mode (PSR.WTDF)
• Data byte transmission code after transfer direction
However until now I wasn't able to find what of the previous conditions arise in my case!
I attach the new version of my code to this post; any additional hint will be appreciated!
Regards.
thank you for your hints; I was already aware of the details about the I2C protocol. In my case the SDA and SCL lines are pulled up by two resistors on the Pololu's breakout board.
I managed to see something coming out from I2C pins (P0.5 and P0.11) adapting the I2C001_Example1 demo project to my I2C peripheral.
However, the communication between the XMC4500 and the accelerometer works well only when I make a step by step run for functions I2C001_WriteData and I2C001_ReadData (I see the correct signals on SDA and SCL with an oscilloscope); when I launch the program in free run (no pause between the single write/read operations) the I2C signals disappear and do not appear even when I pause the program and make it advance again step by step.
Debugging my code I have found that the problem is with these lines of code in the do-while loop of I2C001_WriteData in I2C001.c:
if(I2CRegs->PSR_IICMode & USIC_CH_PSR_IICMode_WTDF_Msk)
{
Result = (bool)FALSE;
break;
}
If I run the program in free run, after the transmission of few bytes on the I2C bus, the WTDF bit comes true and this causes the function to abort returning Result = false.
Looking for WTDF in the XMC4500 Family Reference Manual I found that the WTDF bit is set to true in the following conditions:
• TDF slave code in master mode (PSR.WTDF)
• TDF master code in slave mode (PSR.WTDF)
• Reserved TDF code found (PSR.WDTF)
• Start condition code during a running frame in master mode (PSR.WTDF)
• Data byte transmission code after transfer direction
However until now I wasn't able to find what of the previous conditions arise in my case!
I attach the new version of my code to this post; any additional hint will be appreciated!
Regards.
Not applicable
Dec 11, 2013
06:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 11, 2013
06:51 AM
Not applicable
Jan 14, 2015
11:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 14, 2015
11:01 AM
fradaxx wrote:
OK, I just solved the mistery!
The problem was related to a wrong usage of I2C001_WriteData/Read_Data; I carefully compared my code with the one contained in I2C001_Example1 and I have understood how to use them.
I attach my working code to this post.
Regards
Are you not handling any interupts in the code???