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

XMC™ Forum Discussions

User7921
Level 3
Level 3
Hi everyone,

I'm using the XMC1302 (200kB) together with an I2C DAC.
Talking to the DAC works fine, but now I wanted to implement the reaction on a not working DAC
and I'm trying for many days without success.

The major malfunction case is a not connected DAC device.
I do see that the TX-FIFO is not totally empty and the i2cSend() is not sending pulses on the SCL line (even the function returns a DAVE_SUCCESS...)
Now I'm looking for a way to RESET the whole I2C system, but I can't get it back to work. Only a chip reset does it.
I tried I2C_Init() and even together with UART001_Init() it does not come back to live.

Can anybody give me a hint how to restart the whole I2C system without resetting the micro?

Thanks for any help provided.

Michael
0 Likes
2 Replies
Not applicable
I found this code in another thread and it works for me.

	if(USIC1_CH1->PSR_IICMode & (USIC_CH_PSR_IICMode_ERR_Msk | USIC_CH_PSR_IICMode_NACK_Msk)) {
// Clear error bits
USIC1_CH1->PSCR |= 0x3FF;
// Flush transmit FIFO buffer
USIC1_CH1->TRBSCR |= USIC_CH_TRBSCR_FLUSHTB_Msk;
// Modify Transmit Data Valid
WR_REG(USIC1_CH1->FMR, USIC_CH_FMR_MTDV_Msk, USIC_CH_FMR_MTDV_Pos, 2);


After flushing the FIFO and clearing the TDV bit, the FIFO has to be refilled though.
0 Likes
User7921
Level 3
Level 3
😄
Thanks for your help!

I did think of the TDV bit, but I did not clear the right bit location...
Now it works!

I think, if making apps, such important things like resetting the I²C state machine should be covered by the app.
I like the dozens of empty DeInit functions in the generated dave code :rolleyes:

Thanks agian!
Michael
0 Likes