Seeking example for switching from I2C master to UART and back on one channel

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

cross mob
User8683
Level 4
Level 4
First like received
Hello,

For system initialization, I have a need to communicate with some chips on my board using the XMC1300 as an I2C master for configuration. After the initial communication, I want to switch the I2C master
on the channel to ASC to send out debug information. The second channel is already used so unavailable for that purpose. Unfortunately, I can find no examples to perform this switch and my attempts
have not been successful to date. I have pulled down the old DAVE 3.10 and the latest DAVE IDE but none seems to have code for initializing the channel. In several points in the reference manual, there
are comments regarding switching protocols and I have tried to follow these along with the code that does exist used to uninitialize the I2CSlave.

This is what I have so far for uninitialization:

USIC0_CH0->KSCFG |= (((uint32_t)SHIFT_THREE << USIC_CH_KSCFG_NOMCFG_Pos) & USIC_CH_KSCFG_NOMCFG_Msk);
USIC0_CH0->CCR = 0x00000000U;
USIC0_CH0->KSCFG = 0x00000002U;
USIC0_CH0->FDR = 0x00000000U;
USIC0_CH0->BRG = 0x00000000U;
USIC0_CH0->SCTR = 0x00000000U;
USIC0_CH0->TCSR = 0x00000000U;
USIC0_CH0->PCR_IICMode = 0x00000000U;
USIC0_CH0->PSR_IICMode = 0x00000000U;
USIC0_CH0->TBCTR = 0x00000000U;
USIC0_CH0->RBCTR = 0x00000000U;

USIC0_CH0->PSCR = 0x0001FFFFFU;
USIC0_CH0->TRBSCR = 0x0000C0707;

NVIC_DisableIRQ( USIC0_0_IRQn );

WR_REG( USIC0_CH0->FMR, USIC_CH_FMR_MTDV_Msk, USIC_CH_FMR_MTDV_Pos, 2 );
WR_REG( USIC0_CH0->FMR, USIC_CH_FMR_CRDV0_Msk, USIC_CH_FMR_CRDV0_Pos, 1 );
WR_REG( USIC0_CH0->FMR, USIC_CH_FMR_CRDV1_Msk, USIC_CH_FMR_CRDV1_Pos, 1 );

I would also like to see code for ASC reset if possible.

Jason
0 Likes
1 Reply
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

You could go using the XMCLib (check the examples provided in the XMCLib for using these functions)

XMC_I2C_CH_Init();
// Configure input pins
// Configure interrupts / events
XMC_I2C_CH_Start();
// Configure output pins
XMC_I2C_CH_Stop();

XMC_UART_CH_Init();
// Configure input pins
// Configure interrupts / events
XMC_UART_CH_Start();
// Configure output pins
XMC_UART_CH_Stop();

Regards,
Jesus
0 Likes