Skip to content
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

Fix USB priority preventing CAN TX from timing out #7

Merged
merged 1 commit into from
Oct 29, 2018

Conversation

jorticus
Copy link

The blocking CAN implementation relies on SysTick for its timeout. USB had a higher priority than Systick, so the TX never timed out, causing the serial port to hang indefinitely.

The blocking CAN implementation relies on SysTick for its timeout. USB had a higher priority than Systick, so the TX never timed out, causing the serial port to hang indefinitely.
@jorticus
Copy link
Author

The latest master has an issue where trying to transmit on a bus with nothing listening will cause the adapter to completely hang. Even attempts to close the serial port from the OS hang, and you have to unplug the adapter from the USB port to recover.

I attached a SWD debugger to the device and found it was getting stuck in stm32f0xx_hal_can.c : HAL_CAN_Transmit() at while(!(__HAL_CAN_TRANSMIT_STATUS(hcan, transmitmailbox))). Further investigation showed that HAL_GetTick() wasn't incrementing its counter, which I found was because the interrupt wasn't being fired.

I'd suggest moving any blocking logic out of the ISR and into the main loop, but for now this PR should fix it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants