I have a program that should be run periodically on a MCU (ex. STM32). For example it should be run at every 1 ms. If I program an 1ms ISR and call my complete program in it, assuming it will not exceed 1ms, is that a good way? Is there any problem that I could be facing? Will it be precise?
Is there any problem with computing the whole program in an ISR?
141 views Asked by Mert Celik At
1
There are 1 answers
Related Questions in EMBEDDED
- MSP430F5529 on the MSPEXP430F5529LP: UART is not actually transmitting despite seemingly correct setup. What is wrong?
- A FPGA Project Proposal where I can use both PS and PL
- Program doesn't run after DFU
- Sending struct through queue
- How to generate a VPI warpmap for polynomial distortion correction?
- How to present this example concept in UML: Using 2 LCD displays in C/C++
- CLion: Debug via St-Link
- Portenta H7 Baremetal Development and a Little Guidance on Embedded System Learning Roadmap
- STM32 RTC3 Mixed Mode: Writing TR resets SSR
- Unable to read value from gpio set as input
- Mbed TLS: in-place en-/decryption for OAEP doesn't seem to work
- Shared variable read from low priority thread in preemptive scheduling
- Own Pattern / framework for interfacing with components in C
- Performance Difference Between Global Variable and Local Variable in Embedded Systems
- Comparing analog signal from Electret mic with samples
Related Questions in STM32
- Build issue in my STM32-NUCLEO project using the Eclipse IDE
- STM32 ADC DMA low raw/Voltage readings
- Program doesn't run after DFU
- STM32G030 refuses write to flash
- STM32 - Serial Audio Interface (SAI) - dual data line transmit possible?
- CLion: Debug via St-Link
- STM32 RTC3 Mixed Mode: Writing TR resets SSR
- Ran on an MCU (STM32F1), doubly-linked list code results in a call of HardFault() due to stack overflow
- i want to display voltage of ADC with " ssd1306 OLED " in STM32 when i change the voltage with potentiometer
- spi5 of my STM32MP157F-K2 CAN'T read data from the RC522 CARD
- STM32 unable to be read
- Enabling one timer using another
- Confusion with thumb instructions while compiling recipe for cortexm4 CPU
- How to setup Interface Encoder mode for the STM32F0
- UART Driver for STM32MP25 by EDK2
Related Questions in MICROCONTROLLER
- ESP32 Consequtive Interrupt WDT Timeout Exception
- STM32G030 refuses write to flash
- can't configurate VL53l0x api
- STM32L011K4Tx Compare toggle not working as expected
- How to get PC of first instruction of inline asm block (C)?
- ESP-32 (FreeRTOS): The serial monitor prints unknown symbols (???) instead of a string
- SWO on a Blackpill board
- I2C LCD1602 interfacing with PIC16F877A
- J-Link script to flash program in S32K144 (allow security)
- Design of a function that modifies from 1-4 values of a register
- Is it possible to change values of the zephyr-rtos configuration file prj.conf using CMake arguments?
- Memory Aliasing to a specific Flash Sector
- How to make a proper delay in a microcontroller?
- USART to serial monitor/pc STM32
- How to use a c++ class as wrapper for timer-interrupts on RP2040 (RPPico)
Related Questions in ISR
- getting "undefined reference to ledc_cb_register" error
- ISR INT0 causes Reset on AVR Atmega32
- NEXTjs 13 SSR doesnt work with Link component reentering once visited path
- Is there any problem with computing the whole program in an ISR?
- ESP32 UART interrupt every character
- Implementing ISR in C++ for AVR Mega
- STM32- RTOS -Task Notify From ISR
- Next JS prerendering is not working due to firebase permissions
- speed up the AVR ISR
- Compilation error when creating ISR(vect) interruption : multiple definition of `TIMER0_COMPA_vect'
- ESP32 hardware ISR sometimes not triggered when wifi is transmitting
- What are the various ways to disable and re-enable interrupts in STM32 microcontrollers in order to implement atomic access guards?
- How a context switch works in a RTOS, need clarity
- KEIL4 where the lpc2148 ADC Interrupts or IRQs wont execute
- Should I use volatile for ISRs in C++? (not C)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The usual answer would be probably that ISRs should be generally kept to a minimum and most of the work should be performed in the "background loop". (Since you are apparently using the traditional "foreground-background" architecture, a.k.a. "main+ISRs").
But ARM Cortex-M (e.g., STM32) has been specifically designed such that ISRs can be written as plain C functions. In that case, working with ISRs is no different than working with any other C code. This includes ease of debugging.
Moreover, ARM Cortex-M comes with the NVIC (Nested Vectored Interrupt Controller). The NVIC allows you to prioritize interrupts and they can preempt each other. This means that you can quite easily build sets of periodic "tasks" (ISRs), which run under the preemptive, priority-based scheduler. Interestingly, this scheduler (implemented in the NVIC hardware) meets all requirements of RMA/RMS (Rate Monotonic Analysis/Scheduling), so you could prove the schedulability of your system. Of course, the ISR "tasks" cannot block internally, but this is not required for RMA/RMS. Also, if you have any shared resources between ISRs running at different priorities (or ISR and the background loop), you need to properly protect the resources by disabling interrupts.
So, your idea of using ISRs as "tasks" makes a lot of sense to me. Your system will be optimal meaning that any other approach would be less efficient. (This includes the use of any kind of RTOS.) Also, this design can be low-power because you could use the "background loop" in main() to put your CPU and peripherals into low-power sleep mode (WFI instruction, etc.) In fact, you can view the "background loop" as the idle "task" in this "hardware-RTOS".