pierremolinaro / acan2515

MCP2515 CAN Controller Driver for Arduino
MIT License
74 stars 29 forks source link

Due hangs when the chip select pin entered is wrong #13

Open mvSarma opened 4 years ago

mvSarma commented 4 years ago

Arduino Due stalls while attaching interrupt when the chip select pin number is wrong.

mvSarma commented 4 years ago

The same happens with MKR when I give a wrong chip select pin for the second time.

pierremolinaro commented 4 years ago

I understand, but I don't see how I can protect the library from bad definition of the CS signal, and other signals.

Best regards,

Pierre Molinaro

Le 30 déc. 2019 à 04:58, mvSarma notifications@github.com a écrit :

The same happens with MKR when I give a wrong chip select pin for the second time.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2515/issues/13?email_source=notifications&email_token=AEWKZVEIVGNX2CYTY7RMBBDQ3FWVZA5CNFSM4J7YT3BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZQVAI#issuecomment-569576065, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVG5YH2TWBVAUDL4KL3Q3FWVZANCNFSM4J7YT3BA.

mvSarma commented 4 years ago

I believe here the stall happens because the library tries to attach an interrupt Pin even after figuring out that MCP2515 is not available in the specified CS pin. I am not sure on Arduino's Interrupt library implementation. But this can be avoided if we can check for the pass case of errorCode in addition to the usage check of interrupt pin in ACAN2515::beginWithoutFilterCheck method

if(mINT != 255 && errorCode == 0)

I think this should help me out.

pierremolinaro commented 4 years ago

Ok, I understand what you mean. You are right, it is better to attach the interrupt pin only if there is no error. I will add this bug fix and publish a new release.

Best regards,

Pierre

Le 2 janv. 2020 à 03:22, mvSarma notifications@github.com a écrit :

I believe here the stall happens because the library tries to attach an interrupt Pin even after figuring out that MCP2515 is not available in the specified CS pin. I am not sure on Arduino's Interrupt library implementation. But this can be avoided if we can check for the pass case of errorCode in addition to the usage check of interrupt pin in ACAN2515::beginWithoutFilterCheck method

if(mINT != 255 && errorCode == 0)

I think this should help me out.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2515/issues/13?email_source=notifications&email_token=AEWKZVEYZE5SSQWZDSJ2YCTQ3VFVXA5CNFSM4J7YT3BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5RWQI#issuecomment-570104641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVCUXWBWOD4K53U5LEDQ3VFVXANCNFSM4J7YT3BA.