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

DateTime constructor crashes SAMD21 #81

Open
IowaDave opened this issue Jan 12, 2023 · 1 comment
Open

DateTime constructor crashes SAMD21 #81

IowaDave opened this issue Jan 12, 2023 · 1 comment

Comments

@IowaDave
Copy link
Collaborator

The following constructor caused a hard fault on a SAMD21 device:

DateTime (const char* date, const char* time);

The following minimal snippet illustrates the trouble:

#include <DS3231.h>
DateTime trouble("Jan 12 2023", "12:07:00");
void setup() {
  ;
}
void loop() {
  ;
}

Immediately after uploading, the device loses its Serial connection to the computer. The connection must be restored with a quick double-tap of the reset button before code can be uploaded again.

The other constructors, that use numeric parameters, do not cause this problem in a declaration statement. However, I might have seen a similar result when using the RTClib::now() function farther along in a program. Can't remember.

Perhaps DateTime should be approached with caution on SAMD21 hardware because this repo was written for 8-bit AVR chips. I wonder whether an attempt to read or write some memory location that is not 32-bit aligned may be causing a hard fault which hangs up the CPU.

In the interest of preserving compactness when compiled for AVRs, it may be desirable to create an alternate code body for DateTime to be compiled for the SAMD21G18A architecture. Putting this issue out there for the community to consider. Hope someone who knows the DateTime code intimately can address this issue with skill, before I try to wrap my amateurish hands around it.

David

@hasenradball
Copy link
Contributor

Hi @IowaDave,

how are you?
This issue sounds interesting do you need help?

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