You are here

Use Mutexes within the ppm app

1 post / 0 new
talabo
Offline
Last seen: 3 months 1 week ago
VESC Free
Joined: 2021-06-14 08:52
Posts: 5
Use Mutexes within the ppm app

Hi,

I'm working on a custom firmware, where I wish to use the "servo_val" variable from the ppm app. I save the servo_val to another variable in the ppm loop to ensure I don't save the servo_val value at difference stages, such as before deadband, etc. And to avoid any corrupt reading of the variable from the custom app thread I'm trying to use "chMtxTryLock" and "chMtxUnlock".

 

I've been trying to utilize the mutex in the ppm app, the VESC loses the communication over USB and nothing happens. So what I wish to clearify is how the ppm and custom threads are built differently. Since utilizing the mutex functions in the custom app, I do not experience any crash of the VESC. How come the mutex not be useable in the ppm app?

 

Another question. Can I ignore the need for correct handling of shared resources, as it might be already handled by the original firmware?

 

Summaries question:

Does the ppm thread and the custom thread overlap each other (hence the need for mutexes) or does both threads "finish" their loops before the other thread takes over?