Skip to main content
Visitor II
January 20, 2009
Question

USB and UART interrupt together

  • January 20, 2009
  • 3 replies
  • 1110 views
Posted on January 20, 2009 at 11:07

USB and UART interrupt together

    This topic has been closed for replies.

    3 replies

    miltonAuthor
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:57

    Hi,

    I am trying to setup a system where I use interrupts for the USB communication and UART but I have a problem, I can't use both at the same time ... Both work properly separated, once I try to use both it doesn't work anymore. I think it has to deal with the interrupt priority, because I still have the USB interrupt working once it has a higher priority (0) then the UART (2).

    Someone has an idea? Thanks.

    This is the initialization of both of them:

    UART:

    ...

    SCU_APBPeriphClockConfig(__UART0, ENABLE);

    SCU_APBPeriphReset(__UART0,DISABLE);

    SetCNTR(0);

    SetISTR(0);

    SCU_AHBPeriphClockConfig(__USB48M,ENABLE);

    // UART Module //

    UART_InitStructure.UART_WordLength = UART_WordLength_8D;

    UART_InitStructure.UART_StopBits = UART_StopBits_1;

    UART_InitStructure.UART_Parity = UART_Parity_No ;

    UART_InitStructure.UART_BaudRate = 115200;

    UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;

    UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;

    UART_InitStructure.UART_FIFO = UART_FIFO_Disable;

    UART_DeInit(UART0);

    UART_Init(UART0, &UART_InitStructure);

    UART_ITConfig(UART0, UART_IT_Receive, ENABLE);

    VIC_Config(UART0_ITLine, VIC_IRQ, 2);

    VIC_ITCmd(UART0_ITLine, ENABLE);

    /* Enable the UART0: start sending the transmit FIFO content to the hyperterminal */

    UART_Cmd(UART0, ENABLE);

    UART_ITConfig(UART0, UART_IT_Receive, ENABLE);

    UART_LoopBackConfig(UART0, DISABLE);

    USB:

    SCU_USBCLKConfig(SCU_USBCLK_EXT);

    // Enable USB clock //

    SCU_AHBPeriphClockConfig(__USB, ENABLE);

    SCU_AHBPeriphReset(__USB, DISABLE);

    // USB Initialization

    /* Enable and configure the priority of the USB_LP IRQ Channel*/

    VIC_DeInit();

    VIC_Config(USBLP_ITLine, VIC_IRQ, 0);

    VIC_ITCmd(USBLP_ITLine, ENABLE);

    /* USB initialization */

    wInterrupt_Mask = IMR_MSK;

    SetCNTR(0x0003);

    Token_Event = 0; /* Flags of each endpoint interrupt */

    pInformation = &Device_Info;

    pInformation->ControlState = 2;

    pProperty = &Device_Property;

    /* Initialize devices one by one */

    pProperty->Init();

    Visitor II
    January 5, 2016
    Posted on January 05, 2016 at 07:15

    hi,

    im using the str912faw47 part number.iwant to use internal usb. can u pls send me the usb firmware library.

    Thanks & Regards,

    benarjee pasam.

    09951438009

    astra microwave products ltd.

    Graduate II
    January 31, 2016
    Posted on January 31, 2016 at 19:24

    Seriously doubt anyone is going to call you. If you want phone support you'd need to call an ST sales office.

    The STR9 is a rather dated product at this point, and not at all supported here on the forum

    http://www.st.com/web/en/catalog/tools/PF258060