0 Replies Latest reply on Sep 17, 2020 7:08 AM by Viku_4403276

    uart isr configuration

    Viku_4403276

      Hello All,

       

      I am using sample driver for UART. Its working fine with low level driver(Without interrupt) but, when i am using high level api i am not getting any interrupt.

      sequence calls are following :

      /* SCB - UART Configuration */

      cy_stc_scb_uart_context_t   g_stc_uart_context;

      cy_stc_scb_uart_config_t    g_stc_uart_config = {

                                                         .uartMode                   = CY_SCB_UART_STANDARD,

                                                         .oversample                 = 1,

                                                         .dataWidth                  = 8,

                                                         .enableMsbFirst             = false,

                                                         .stopBits                   = CY_SCB_UART_STOP_BITS_1,

                                                         .parity                     = CY_SCB_UART_PARITY_NONE,

                                                         .enableInputFilter          = false,

                                                         .dropOnParityError          = false,

                                                         .dropOnFrameError           = false,

                                                         .enableMutliProcessorMode   = false,

                                                         .receiverAddress            = 0,

                                                         .receiverAddressMask        = 0,

                                                         .acceptAddrInFifo           = false,

                                                         .irdaInvertRx               = false,

                                                         .irdaEnableLowPowerReceiver = false,

                                                         .smartCardRetryOnNack       = false,

                                                         .enableCts                  = false,

                                                         .ctsPolarity                = CY_SCB_UART_ACTIVE_LOW,

                                                         .rtsRxFifoLevel             = 0,

                                                         .rtsPolarity                = CY_SCB_UART_ACTIVE_LOW,

                                                         .breakWidth                 = 0,

                                                         .rxFifoTriggerLevel         = 0,

                                                         .rxFifoIntEnableMask        = E_UART_RX_INTR_FACTER,

                                                         .txFifoTriggerLevel         = 0,

                                                         .txFifoIntEnableMask        = E_UART_TX_INTR_FACTER

                                                      };

       

      main()

      {

       

      /* Initilize & Enable UART */

          Cy_SCB_UART_DeInit(CY_USB_SCB_TYPE);

          Cy_SCB_UART_Init(CY_USB_SCB_TYPE, &g_stc_uart_config, &g_stc_uart_context);

          Cy_SCB_UART_RegisterCallback(CY_USB_SCB_TYPE, (scb_uart_handle_events_t)Scb_UART_Event, &g_stc_uart_context);

             Cy_SCB_UART_Enable(CY_USB_SCB_TYPE);

         NVIC_EnableIRQ(CPUIntIdx2_IRQn);

          Cy_SysInt_InitIRQ(&stc_sysint_irq_cfg_uart);

          Cy_SysInt_SetSystemIrqVector(stc_sysint_irq_cfg_uart.sysIntSrc, Scb_UART_IntrISR);

      }

      void Scb_UART_IntrISR(void)

      {

      #if defined(E_UART_ECHO_INTR_1BYTE)

          /* UART Echo Test (High-Level)            */

          /* (2) Interrupt & Receive by 1 byte unit */

          uint32_t num = Cy_SCB_UART_GetNumInRxFifo(CY_USB_SCB_TYPE);

          if (num != 0) {

              Cy_SCB_UART_Receive(CY_USB_SCB_TYPE, &g_uart_in_data[0], num, &g_stc_uart_context);

              Cy_SCB_UART_Transmit(CY_USB_SCB_TYPE, &g_uart_in_data[0], num, &g_stc_uart_context);

              Cy_SCB_SetRxFifoLevel(CY_USB_SCB_TYPE, 0);

          }

      #endif

       

       

          /* UART interrupt handler */

          Cy_SCB_UART_Interrupt(CY_USB_SCB_TYPE, &g_stc_uart_context);

          NVIC_ClearPendingIRQ(CPUIntIdx2_IRQn);

      }

       

      Thanks is advance