Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of using FreeRTOS to encounter death and other exceptions

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to solve death and other anomalies in the use of FreeRTOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Problem scenario:

When using apollo3, debugging found that the semaphore jammed as soon as the semaphore was sent in the ADC interrupt.

Retro code:

The traceability code found that the call to xQueueGenericSendFromISR actually got stuck during the ADC interrupt. The location of the jam is as follows.

This macro is defined as follows

Keep looking inside, and find the card in the lower position.

This assertion is as follows

So the condition you see in printing is 0 > = 128, so while (1); it's stuck here.

Analysis code

This is to get the value of the ipsr register, which is stored in the ulCurrentInterrupt variable, so what does the ipsr register represent? here you write https://blog.csdn.net/weixin_41572450/article/details/105027244.

Represents the interrupt number, and this macro

Indicates that the user interrupt number starts at 16, and 1-15 is the familiar kernel interrupt number, as follows

The interrupt number of apollo is as follows

You can see that there are also 16 kernel parts, of which the interrupt number of ADC is numbered to 32 (note that 16 kernel numbers should be added here)

So

If (ulCurrentInterrupt > = portFIRST_USER_INTERRUPT_NUMBER)

This condition means that when an external interruption occurs, it goes within the if condition.

To sum up, it is

UcCurrentPriority = (uint8_t *) (0xE000E3F0+ulCurrentInterrupt) that is ucCurrentPriority = (uint8_t *) (0xE000E3F0+32) that is ucCurrentPriority = (uint8_t *) (0xE000E400+16)

Where 0xE000E400 is the NVIC- > IP register address

The interrupt priority of the external interrupts stored here is as follows

So the 0 of 0 > = 128is the reset value of IP [ADC] register, that is, the interrupt priority of ADC is set to 0, which means that the priority of ADC is not set during initialization. If you check it, you will have no problem if you add the following settings.

How did that 128 come from? As follows

So it's 128.

Finally, it was found that this problem was mentioned in the previous English notes, and finally there was a website.

Https://www.freertos.org/FAQHelp.html

The following instructions are given

This is the end of the content of "how to solve the death and other exceptions encountered in using FreeRTOS". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report