3 Replies Latest reply on May 26, 2020 12:29 AM by XinghaoZ_26

    Timing and interrupts


      In my application, I use a CYW20736S and I need to implement a state machine. I have many GPIOs, UART, BLE, timer ... and multiple modes of user cases.


      I know it's not possible to have a main() loop because this is a multi-threaded system and the architecture of the application is designed to be an event-driven system. Is there a way to implement a state machine?


      I use this timer to count 5ms and to do some stuff (button, output switching, periodics data transmission in uart...):

      bt_clock_based_periodic_timer_Enable(application_timer_expired_callback, NULL, 5000/625);        // 5ms


      I would like to use the fine timer for my state machine. Is it possible to use this one in addition to the previous?

      I would like to know how many times I can stay on the fine timer interrupt? If it's possible, can I receive BLE notifications, UARTdata or 5ms timer interruption asynchronously during a fine timer interrupt? Do you think it's possible to do many instructions in a fine timer interrupt without problems (watchdog interrupt? stacking interrupts?). Is there a way to configure priority interruptions between UART, timer, BLE notification?