IIC Problems with XMC1100

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

cross mob
Not applicable
Hi there,
I can't get any output trying to set up IIC connection on PIN 2.0 (SCLKOUT) and PIN 2.1 (DOUT0). Any other PIN would also be ok.
Does anybody have an example, that shows all the required register settings?

I intialize by the following code:

switch_on(USIC0); //--- Channel 0---
//USIC Parameter
USIC0_CH0->KSCFG = 0x3; //KSCFG=3; switch on USIC
USIC0_CH0->CCR = 0; //0 to set all parameters
USIC0_CH0->SCTR=(7<USIC0_CH0->CCR = IIC<USIC0_CH0->DX0CR = (DXnF<
Baudrategenerator(0, IIC, 9600); //Channel 0; IIC; 9600 Bit/s //this function sets all registers for for the transmission clock

//PINs
multiplexer(2,0,Open_Drain+Alt7);//P2.0: SCLKOUT
multiplexer(2,1,Open_Drain+Alt6);//P2.1: DOUT0 und DX0F
PORT2->PDISC=0;

//FIFO Tx
uint32_t TxSize = 4; //Buffersize = 4 for 16 entries
USIC0_CH0->TBCTR = 0;//Size = 0
USIC0_CH0->TBCTR = (0<
uint32_t RxSize = 4; //Buffersize = 4 for 16 entries
USIC0_CH0->RBCTR = 0;//Size = 0
USIC0_CH0->RBCTR = (16<
USIC0_CH0->TCSR = (1
//send data
USIC0_CH0->IN[0]=4; //send start
USIC0_CH0->IN[0]=adress;

thanks in advance for any help
0 Likes
2 Replies
Not applicable
Hi,

I have further investigated the problem and verified that the data is in TBUF as valid data. TCSR is 0x10000481 which means TDV, TDSSM, TDEN, TSOF and TV are all set to 1.
I also noticed that even when I write 0xff directly to TBUF, SCTR.WLE indicates 1 data bit at position 0. Before that the wordlength has been set to 7.

Any ideas, what could be wrong?
0 Likes
lock attach
Attachments are accessible only for community members.
chismo
Employee
Employee
First like received
Hello,

There could be problems with your code. For example, I see that:
- Passive high output level is not selected with SCTR.PDL=1.
- Transmit buffer is not enabled with TCSR.TDEN=1. This is required also when using FIFO.

For your reference, I attached an example code of USIC IIC communication with an external temperature sensor below.
The example code is based on the older DAVE3 and is not using FIFO.

Example FIFO configurations could be:

/// ------------------------------------------------------------
/// Configure TXFIFO
/// - TXFIFO starts from FIFO buffer entry 0
/// - TXFIFO size of 16 words
/// - Standard transmit buffer event is triggered when fill level
/// falls below 9, i.e. transition from 9 to 8
/// ------------------------------------------------------------
USIC0_CH1->TBCTR=(0<<28)|(4<<24)|(0<<15)|(0<<14)|(9<<8)|(0<<0);

/// ------------------------------------------------------------
/// Configure RXFIFO
/// - RXFIFO starts from FIFO buffer entry 32
/// - RXFIFO size of 16 data words
/// - Standard receive buffer event is triggered when fill level
/// exceeds 7, i.e. transition from 7 to 8
/// ------------------------------------------------------------
USIC0_CH1->RBCTR=(1<<28)|(0<<27)|(4<<24)|(0<<15)|(0<<14)|(7<<8)|(32<<0);


Regards,
Min Wei
0 Likes