-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CAN] Control callback crashes when using thingset_import_data #57
Comments
Yeah, the data does indeed look correct. I've just double-checked if acquisition of the ThingSet context lock might have failed, leading to a dead lock. But that should have printed an error message. Did you double-check if the stack size of the calling thread is large enough? |
I've tried passing |
As far as I can see it's offloaded to the system work queue, so the stack would be |
Ok, my bad, I've tried this morning with |
Ok. Don't have another idea at the moment, unfortunately, except for trying to step through the function with a debugger and see where it crashes. |
I gave the debugger a chance today. I got the following log:
It seems to fail because of the
I'm not sure why though.. I tried increasing the THINGSET_CONTEXT_LOCK_TIMEOUT_MS to |
I'll pass the My doubts below : I'm not sure how to properly "fix" this. Should we add this kwork in the SDK directly ? This would be neat as the work item could be sent to the thingset workqueue instead of the system one. But then how to define user based logic to set software level filtering on the incoming can control messages ? Is it okay to introduce timing uncertainty (because of kwork) when receiving RX control messages ? Ideally we would like to make sure that they are dealt with ASAP. |
If you look into your log output, the following line gives some hints about what's wrong:
Looks like the function is called from ISR context and the below assertion fails: Are you sure it's called from a kwork item? |
The cause of the crash is indeed because |
Ok, so it should work if you offload it to a work item. |
Got it working with a work item : jalinei/Core@ae1983f As an enhancement I suggest to add a warning in the doxygen comment of Additional considerations :
|
I guess it doesn't make a big difference.
Yeah, it would introduce a small delay. We could instead make the timeout configurable and set it to |
Hehe classical Real Time tradeoffs nightmare. In practice, not being able to lock Obviously it depends on the use-case, but IMO it is a good practice to have a way of knowing when incoming control reference has been delayed, in order to be able to reject it for application in which it could not be okay being 800ms late.. A potential middleground, would be to have by default as |
Hi, it's me again 😄
I'm currently troubleshooting CAN control broadcasting.
My current setup is the following : Two nodes are connected, one is broadcasting one data object with object-id
0x8001
, I'm listening the bus with the Peak dongle.The nodes have a
can_control_rx_handler
that go through these control messages withids > 8000
I'm facing what I do believe is a bug :
Using
thingset_import_data
in control report callback leads to a general crash, without anyLOG_ERR
or
LOG
of any kind. The MCU gets fully stuck without outputting anyfatal
reporting.I'm using the sample you've done when we were working on the Vhelio e-bike.
jalinei/Core@6dccaba
I've commented out the culprit function and I've added
HEXDUMP
to check the frame before usingthingset_import_data
.I'm posting the
HEXDUMP
output below, it seems valid to me.Here is the corresponding
candump
snippet, everything looks sane as well.I made sure that the data item is writtable in my data_object :
At first I was having a different setup in which both nodes where broadcasting the same
0x8001
data objct, so I was thinking that it was some kind of race conditions to access the data-object.I simplified the setup so only one node is broadcasting and the second is listening, and I still have the same issue. I works perfectly without calling
thingset_import_data
but crashes when calling it.Any clue in what direction to look ?
The text was updated successfully, but these errors were encountered: