-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ports/nrf: Add RTC support to NRF ports. #10400
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
Conversation
Thanks. It looks much more clean now, and it works. Some questions:
About code style:
|
Thanks! I'm about to shut down for the night so I'll pick this up tomorrow. Git is one of the things I'm still far from comfortable with, I was unaware of the "squash" option. I just googled it and will take care of it tomorrow as well! |
Good night. Testing with a division by 1000 results in proper time after an hour. Using 999 it was as expected 3 seconds ahead. There is another hiccup in the code. So you would have replace ticks_ms() by something like:
and |
Another note: time.sleep() depends not on RTC. So it can be moved in modutime.c. |
I don't think I got the squash right, it didn't seem to have the effect I thought it would. Never mind, it just took a minute 😁 |
@robert-hh Thank you so much for taking the time to walk me through all this! |
You're welcome. I had the board now 6 hours running with the suggested code change, and the time is still on spot. So it looks OK. I also had tested the state, when value of ticks_ms_64() exceed 32 bit. |
I wasn't real happy with that either but pwm.h was right there and didn't have much in it either so I wasn't sure. I'll give the amend a try to fix it. 😁 |
Whatever you prefer. But if you drop rtx.c, do not forget to do |
Could I have just pushed to get the amend to go or was the --force needed? |
Looks Good. Git complains, if the force option is needed, |
This is an automated heads-up that we've just merged a Pull Request See #13763 A search suggests this PR might apply the STATIC macro to some C code. If it Although this is an automated message, feel free to @-reply to me directly if |
See alternate |
I tried to remove the STATIC keywords, however I don't know github well enough to bring this PR up to date. If someone wants to walk me through the command line steps I need to rebase? this, just let me know. Thanks. |
|
Okay, I think I've rebased but Micropython has changed some things basic to my PR and the RTC changes don't work with my newly built firmware. It's been a long time since I worked on this and only made it through the first time with a lot of guidance from robert-hh so I'm thinking since there's another PR that addresses this, unless there's something my PR has which that one doesn't, this one should just be passed over in favor of #13340 |
Well I stole one block of code from the other PR and the RTC seems to be running again on my local build. Github still sees a conflict which I'm not sure how to resolve and there is no time.time() method.
|
To get time.time(), you have to set in mpconfigport.h the value: The errors mentioned for the PR are caused by the commit message: |
Thanks,
Do you think it's worth getting this cleaned up considering there is another PR? If there's some advantage I'll keep plugging at it... |
The only thing missing seems to be time.time(). You can easily create the missing mp_time_time_get() with the data from the RTC, similar to how rtc_get_time() gets the seconds. There still one commit message formatting complaint. The signature line is missing. Both with the Edit: <joke> There are plenty of these lines in the commit |
I haven't worked on a Micropython PR since this one over a year ago so I've forgotten all the github hoops. I know you walked me through a squash last year to clean things up, but sadly, your joke has gone over my head 🤷 😁 I'll go ahead and get the time.time going as well.... |
The only thing I'm curious about is
So you have to resolve that in a commit (any of them). Preferred in |
I've been manually fixing that via the github web interface, but it was coming back after every push from local. I'll see if I can figure out how to resolve it in the |
I also noticed a bunch of unexpected changes to individual nrf boards' mpconfigboard.h files, so I'm going through and taking those changes out. |
A lot of that was changed in the commit |
One thing that this pull request has over mine (#13340) is the use of |
I started this PR by lifting the code from CircuitPython and then with the guidance of robert-hh rearranged it to work with Micropython so I am probably not the right person to ask. That being said, could it have something to do with maintaining the clock through soft resets? |
Well for what it's worth, this seems to be working again although github is telling me the branch cannot be rebased due to conflicts. It's no longer identifying the conflicts though. Edit: If there's interest in merging this, I'm happy to submit a fresh PR with theses changes if the rebasing message means this PR is borked. |
It's still mphalport.c which causes the trouble. But maybe starting over make things look better. |
OK, I will take a look at what CircuitPython is doing there with the validity check. By the way, starting over does not mean that you need to make a new PR. You can just force-push to this one. |
Well that didn't go well, I obviously did the force push wrong since it closed the PR :/ |
Updated after reviewing RTCounter.py. It turns out that RTCounter starts up and uses the second nrf rtc unit so piggybacking off of that this update doesn't need most of the Circuitpython logic the earlier PR was using and takes care of starting up the rtc which had been omitted.
Since RTCounter uses rtc unit 1 this PR compiles on all of the currently supported nrf series boards.
Signed-off-by: RetiredWizard github@retiredwizard.com