How to use ADC components in FreeRTOS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use ADC components in FreeRTOS

Jump to solution
1,487 Views
kimdukyu
Contributor II

Hi.

It is being developed at S32DS Design studio, and MPC5746C MCU chip is used. I am using FreeRTOS component and ADC component together. The problem is that it stops at IVOR1_Handler in the process of ADC_Init() function processing. I don't know why for this problem. I am attaching the source code, so please answer the question. 

For reference, the symbol "USING_OS_FREERTOS" is defined as shown in the figure below.

Please give me a quick reply.

Thank you to everyone.

0 Kudos
Reply
1 Solution
1,453 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Dukyu,

sorry for delayed response.

I have only MPC5748G here today, so I tried to load your project to this board. I didn't re-compiled the project, I used your elf file directly to be sure it's exactly the same. I can see that the ADC Init function is successfully executed and  then it continues the execution, I can see no exceptions.

I can try it directly on MPC5746C on Monday to see if there's a difference.

Regards,

Lukas

View solution in original post

0 Kudos
Reply
4 Replies
1,481 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Dukyu,

It seems you uploaded wrong project, I can’t see ADC there.

But common mistake is: if a function/driver uses OS services, it's mandatory to call them after starting the scheduler. Maybe this is the reason.

I can remember this discussion which could be helpful:

https://www.freertos.org/FreeRTOS_Support_Forum_Archive/March_2017/freertos_What_is_normal_method_fo...

Regards,

Lukas

0 Kudos
Reply
1,463 Views
kimdukyu
Contributor II

Dear Lukas,

 

First of all, thanks for the quick reply. The source code is attached again. According to your answer, do I need to initialize the ADC in the function registered in the scheduler? Even if I initialize the ADC in the task, the same symptom was present. Please give me a more detailed answer.

 

Can you please check whether ADC group setting and code writing in the attached source code are correct?

 

Thank for Lukas.

 

0 Kudos
Reply
1,436 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

I tested it on MPC5746C now and it also works. Where does it fail exactly in the project? Which instruction?

Regards,

Lukas

0 Kudos
Reply
1,454 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Dukyu,

sorry for delayed response.

I have only MPC5748G here today, so I tried to load your project to this board. I didn't re-compiled the project, I used your elf file directly to be sure it's exactly the same. I can see that the ADC Init function is successfully executed and  then it continues the execution, I can see no exceptions.

I can try it directly on MPC5746C on Monday to see if there's a difference.

Regards,

Lukas

0 Kudos
Reply