Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

USB low-full-high speed peripherals Forum Discussions

CSK10
Level 2
Level 2
10 replies posted 25 sign-ins 10 questions asked

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  

0 Likes
2 Replies
MallikaK_22
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 250 replies posted

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

0 Likes

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 

0 Likes