Timing and interrupts

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

cross mob
Juar_2150386
Level 4
Level 4
5 likes given First like received First like given

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?

Thanks,

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Could you check the following thread to see if it can help: Timer in 2073x

View solution in original post

0 Likes
3 Replies
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

Could you check the following thread to see if it can help: Timer in 2073x

0 Likes

Thanks for the help.

Do you have answer about the second part of my question ( time stay on the interrupts and consequences) ?

0 Likes

It is OK to do these things in the timer callback. The lower level uses tasks for different operation.