- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello ,
I have a peice of code written for interfacing a I2c based temperature sensor with Fx2lp. If i write this code in TD_POLL function the device does not re-enumerate.
Can someone explain me this reason and also then what would be the appropriate approach here ?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
TD_Poll is an infinite loop while TD_Init() is for initialising endpoints, clock and LEDs. Can you please check Vend_Ax example code?
You can use a separate .c file for i2c related functionality and not include it with TD_Init and TD_Poll.
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please provide more details about your application like what sensor are you using and schematics if possible.
How does the device enumerate after reprogramming?
Regards,
Mallika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi I am using temperature sensor 102 for interfacing . I also stumbled upon this article Why Certain EZ-USB® FX2LP™ DVK Firmware Examples F... - Infineon Developer Community but still doesnt help me much.
EZUSB_InitI2C(); // Initialize I2C bus
BUFFER[0] = Reg_temp;
EZUSB_WriteI2C(Tmp102_ADDR, 1, BUFFER);
EZUSB_WaitForEEPROMWrite(Tmp102_ADDR); // wait for I2C write to complete
EZUSB_ReadI2C(Tmp102_ADDR, 2, BUFFER);
//Combine the bytes
val = ((WORD)BUFFER[0] << 4) | (BUFFER[1] >> 4);
// Convert to 2's complement, since temperature can be negative
if ( val > 0x7FF )
{
val |= 0xF000;
}
// Convert to float temperature value (Celsius)
temp_c = val * 0.0625;
// Convert temperature to decimal format
temp_c *= 100;
sprintf((char*)BUFFER,
"%u.%02u C\r\n",
((unsigned int)temp_c / 100),
((unsigned int)temp_c % 100));
this is the code that i write in the TD_POLL function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
TD_Poll is an infinite loop while TD_Init() is for initialising endpoints, clock and LEDs. Can you please check Vend_Ax example code?
You can use a separate .c file for i2c related functionality and not include it with TD_Init and TD_Poll.
Regards,
Mallika