Motor Control Class: Lecture 5 - Hall Sensors

cancel
Showing results for 
Search instead for 
Did you mean: 

Motor Control Class: Lecture 5 - Hall Sensors

4,342 Views
dumitru-daniel_
NXP Employee
NXP Employee

In this fifth lecture of the motor control course we discuss about how can we read the hall sensors to obtain the rotor position in order to know how to apply the correct voltage sequence to the motor phases. 

 

Main topics:

    - How Hall sensors works;

    - How to define a commutation sector;

    - How to identify the hall sensors and hall sensors alignment;

    - How to build applications to read the hall sensors via GPIO and eTIMER Capture;

    - How to implement an enhancement to read the rotor initial position to allow the startup from any position;

 

Objectives:

    - Understand how hall sensors works;

    - Implement from scratch Simulink models for GPIO and eTIMER for MPC5744P;

    - Setup FreeMASTER for real time data visualization;

 

NOTE: Chinese viewers can watch the video on YOUKU using this link

注意:中国观众可以使用此链接观看YOUKU上的视频

 

186519_186519.JPG1.JPG186518_186518.JPG2.JPG186520_186520.JPG3.JPG

 

NOTE: Chinese viewers can watch the video on YOUKU using this link

注意:中国观众可以使用此链接观看YOUKU上的视频

 

186522_186522.JPG5.JPG186521_186521.JPG6.JPG186523_186523.JPG7.JPG

 

NOTE: Chinese viewers can watch the video on YOUKU using this link

注意:中国观众可以使用此链接观看YOUKU上的视频

 

Additional information:

    - pdf attached with slides shown in these videos;

    - Simulink models used in these videos;

Original Attachment has been moved to: Lecture5---Simulink-Models.zip

Update revisions:

February 25, 2019

May 06, 2020

22 Replies

1,228 Views
haoxue1027
Contributor IV

Hi Dear Daniel,

dumitru-daniel.popa

when i follow the course of lesson 9 to cancel  the diagnostic :eTimer and GPO like this

pastedImage_3.png

the matlab is abnormal termination .  I have added the  text of abnormal termination.

Can you help me solve the problems.

best regards.

hao

0 Kudos

1,228 Views
dumitru-daniel_
NXP Employee
NXP Employee

constantinrazvan.chivu‌,

Can you please have a look and if necessary fill a bug to MathWorks ?

Thank you!

Daniel

0 Kudos

1,228 Views
haoxue1027
Contributor IV

Hi ,Constantin Razvan Chivu

Is there any solutions to solve the abnormal termination?

best regards

hao

0 Kudos

1,228 Views
constantinrazva
NXP Employee
NXP Employee

Hello haoxue1027@qq.com‌,

Can you share the model you are using and let us know what toolbox version you are using? This way I can see if the issue is within our toolbox in the etimer_mpc574x_config.mex64 or some Simulink issue and open a ticket to MathWorks.

Kind regards,

Razvan.

0 Kudos

1,228 Views
haoxue1027
Contributor IV

Hello Constantin Razvan Chivu

Thanks for replying.

The model i used is the attachment of the Lecture 5-Hall Sensors .

 MATLAB versions is  matlab2018a

best regards

hao

0 Kudos

1,228 Views
constantinrazva
NXP Employee
NXP Employee

Hello @haoxue1027@qq.com 

I was referring to what version of our (NXP) toolbox. Can you run the following command in the MATLAB terminal and share the output with us?

ver

I suspect some setup issue and for that I'll have to replicate yours to come up with a solution. Thank you for understanding.

Kind regards,

Razvan.

0 Kudos

1,225 Views
haoxue1027
Contributor IV

hello@Razvan

I'm sorry to bother you, is there a solution for this problem?
I run the course again for the demo given by the course , found that system began to collapse until i use the Function-Call subsystem.

There is nothing wrong with using the routines from before lesson 5.

Please check if there's a link between the use of subsystem and system collapse ?

When I use demo"PMSM_ClosedLoop_mpc5744p", system collapse occured.

best regards

hao

0 Kudos

1,224 Views
constantinrazva
NXP Employee
NXP Employee

Hello haoxue1027@qq.com,

Please try what I've said in the topic you opened error during build (hall sensors)MBD for MPC5744P. Let us know if that fixed your issue, as I can not reproduce it.

Kind regards,

Razvan.

0 Kudos

1,224 Views
haoxue1027
Contributor IV

Hello,Razvan

thank you very much for reproducing the issue.

I have reset the path as you mentioned in error during build (hall sensors)MBD for MPC5744P ,but it seems not work.

There is something wrong with my computer system. 

Thanks again for the answer to this question.

reset path.pngAbnormal termination.png

best regards

hao

0 Kudos

1,228 Views
haoxue1027
Contributor IV

Hello,Razvan

 sorry for replying late.

The file has been added to the attachment,

please check.

best regards

hao

0 Kudos

1,228 Views
constantinrazva
NXP Employee
NXP Employee

Hello haoxue1027@qq.com,

Sorry for the late reply - I found that you are using the 3.1.0 version of our release - I answered on the topic you opened on this issue. Briefly - I can not seem to be able to reproduce this issue you are having; please try my recommendations and let us know if that did the trick.

Kind regards,

Razvan.

0 Kudos

1,228 Views
yujiangwu
Contributor III

Hi Dear Daniel,

dumitru-daniel.popa

Thanks for the excellent video first. I encountered a @Mahd Khalid. When I try to implement "EventBased_ReadHallSesnor". I get the error "Can not detect the board information" on FreeMaster. Specifically, when I add eTimer0 channel2 into the diagram. I start running into trouble. 

In the picture, if I remove the portion circled by the green circle. I am good. 

Thanks for your help!

Sincerely,

Yujiang Wu

problem.png

1,228 Views
mahdkhalid
Contributor III

Hi yujiangwu


Thank you for the reply.
How do you read the hall sensor C after removing this block?
Thanks,

Mahd Khalid

0 Kudos

1,228 Views
yujiangwu
Contributor III

Hi mahdkhalid‌,

I did it just for debugging to see what was causing the issue with Freemaster. Yes, you do need it to read Hall_C. Please have a look at Freemaster Can't detect the board information.  Hope you can solve the issue as well.

Sincerely,

Yujiang Wu

1,228 Views
mahdkhalid
Contributor III

Hi,

When using the EventBased_ReadHallSesnor file I get the same error "Can not detect the board information" on FreeMaster

I don't get this error in the ReadHallSensor file.
I have already applied the hotfix

Do I need to use CAN instead of UART?

Regards

Mahd Khalid

0 Kudos

1,228 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi mahdkhalid‌,

Switching to CAN is only required when your will use the MOTORGD to spin the motor because only then the TX1 will interfere with GD_RST_B pin that is supposed to be hold to 1 during pre-driver initialization and normal operation.

In this case i think there is a different issue. Perhaps and error in the model - like FreeMASTER configuration.

Hope this helps!

Daniel

0 Kudos

1,228 Views
lukasschäfer
Contributor III

Hi dumitru-daniel.popa

i have a question to the eTimer module.

What value gives the STS Register? Is there a possibility to get the counting value of the eTimer like in the toolbox of the s32k144? To get a time stamp or to measure the time between two edges?

Best regards

Lukas

0 Kudos

1,228 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi lukasschäfer‌,

The STS output maps over the Channel n Status Register (ETIMER_CHn_STS)

pastedImage_1.png

Each flag description can be found in the Reference Manual at page 1092.

To count between 2 edges you can:

#1: use the eTimer_capture block

pastedImage_2.png

#2: Or, you can use the STS to trigger some subsystem to count for.

#3: Or, you can use the eTimer ISR trigger output to start a SW counter (as i did in the Lecture 10) assuming there is no HW support for such capture event.

Hope this helps!

Daniel

0 Kudos

1,228 Views
lukasschäfer
Contributor III

Hi dumitru-daniel.popa,

can you show me how to configure the eTimer_configuration block when i want to measure the time between two edges with the eTimer_capture block?

Thank you.

Best regards

Lukas

0 Kudos

1,228 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi lukasschäfer‌,

Have you tried to use and it and you got wrong results ?  or do you have issues to configure the eTimer_config Block compared with the functionalities exposed in the Reference Manual ?

Best regards,

Daniel

0 Kudos