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

ACAN2515::begin() hangs if less than about 900b free RAM is left on Arduino UNO #2

Open
PatrykSSS opened this issue Jan 15, 2019 · 3 comments

Comments

@PatrykSSS
Copy link

To reproduce put the following code before ACAN2515::begin() in LoopBackDemo:
static char Buf[600]; Serial.print(Buf);
Result:
Sketch uses 7532 bytes (24%) of program storage space. Maximum is 30720 bytes.
Global variables use 1122 bytes (54%) of dynamic memory, leaving 926 bytes for local variables. Maximum is 2048 bytes.
Checked with Arduino IDE 1.8.8 (1.8.19.0 in Windows Store). I would expect some error to be returned instead, and if the library has indeed so large memory requirements then it could be stated in the documentation. It also prevents usage of two instances (with two CAN interfaces).

@pierremolinaro
Copy link
Owner

pierremolinaro commented Jan 15, 2019 via email

@PatrykSSS
Copy link
Author

Thanks for the explanation and solution - so it looks like either dynamic allocation of buffers failed (and mBuffer doesn't seem to be checked for 0/NULL within ACANBuffer{}), or heap and stack were both growing towards each other and this led to clash. Anyway I have adapted buffer numbers to my needs and now my CHAdeMO controller for electric car has two CAN buses as mandated by the standard - one for communication with the CHAdeMO station and one to talk with BMSes / current sensor / display. Thanks! :-)

@pierremolinaro
Copy link
Owner

pierremolinaro commented Jan 16, 2019 via email

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

No branches or pull requests

2 participants