+ Reply to Thread
Results 1 to 2 of 2

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

  1. #1
    New Member New Member longtimer is on a distinguished road
    Join Date
    Jun 2014
    Posts
    88
    Points
    95.625

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

    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

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    601
    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
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.