KL25Z UART updating tpm period

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

KL25Z UART updating tpm period

Jump to solution
542 Views
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

Labels (1)
0 Kudos
1 Solution
395 Views
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

View solution in original post

0 Kudos
3 Replies
396 Views
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 Kudos
395 Views
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 Kudos
395 Views
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 Kudos