I have a sketch which was written to allow a reverse camera to function correctly in a different year of car. It works by reading data from the HS-CAN bus via interrupt and then every 150ms sends a recalculate CAN message out on the MS-CAN bus.
This all seems to work great - except if the car has been stopped and restarted again (but not every time). at this point the code appears to freeze and requires a reset to start working again.
The problem appears to be in the interrupt of sending out the MS-CAN message - after a car restart it stops sending it out.
I can't see anything obviously wrong - but it seems to be to do with the sleep functions, because if i remove the set_sleep_mode(SLEEP_MODE_IDLE) from the receiving loop, the problem doesn't happen.
Anyone give me any ideas why and a better way of doing this?
rear camera.txt (2.51 KB)