KL25Z UART updating tpm period

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

KL25Z UART updating tpm period

跳至解决方案
594 次查看
nicas16
Contributor II

Hello everyone 
I have 8 servos in PWM channels of KL25Z that i want to control via serial from my Visual Studio solution.

I'm using UART1 to receive data and update the tpm period that control the servos.

My problem is that i get a HardFault when i call the UpdateServo function from the UART1 IRQHandler.

 

I thinking it's happening because i'm calling it from the interrupt handler.

Any idea how i can fix this problem?

 

MCUXpresso project are attached.

 

Thanks for your help

Original Attachment has been moved to: BipedRobot.zip

标签 (1)
0 项奖励
1 解答
447 次查看
nicas16
Contributor II

I solved the error \o/

It was in my servo struct. I have 8 servos but only 7 address in my array ... My bad 

Thanks for your help

在原帖中查看解决方案

0 项奖励
3 回复数
448 次查看
nicas16
Contributor II

I solved the error \o/

It was in my servo struct. I have 8 servos but only 7 address in my array ... My bad 

Thanks for your help

0 项奖励
447 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Please refer the method description in 'Tracking down Hard Faults' first.
And you can also tell me how to appear the Hard Fault. For example: What message need I send to the UART1?

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
447 次查看
nicas16
Contributor II

I tracked the hard fault. It happens when I call any fls_tpm.h function (TPM_StartTimer(), TPM_UpdateChnlEdgeLevelSelect()...)

You can send the message
85 1 30 40 50 60 70 80 90 100 68

85 -> Header
1 -> Command

30, 40, 50, 60, 70, 80, 90, 100 -> Servo Data

68 -> Xor for byte 0 to byte 9

thanks for your help

0 项奖励