-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards: add initial support for the PINE64 PineTime smartwatch #12552
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
examples/hello-world output:
Other than that, I tested xtimer_msg, which works fine. |
dist/tools/codespell/check.sh
Outdated
@@ -38,7 +38,7 @@ ${CODESPELL_CMD} --version &> /dev/null || { | |||
CODESPELL_OPTS="-q 2" # Disable "WARNING: Binary file" | |||
CODESPELL_OPTS+=" --check-hidden" | |||
# Disable false positives "nd => and, 2nd", "WAN => WANT", "od => of" | |||
CODESPELL_OPTS+=" --ignore-words-list=ND,nd,WAN,od" | |||
CODESPELL_OPTS+=" --ignore-words-list ND,nd,wan,od,dout" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh? Was this supposed to end up in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, sorry, thanks!
db33e00
to
e702726
Compare
|
Awesome! Skimming through the display controller datasheet, it looks like it is compatible with the display driver from #9948 |
Yeah! I've already configured the settings. 1 hour of RIOT hello-world drained the battery, need to recharge before I can try... |
Can we have some proof when you have the display working? 😄 |
Sure! 😄 It's all black at the moment, though. |
@kaspar030 @bergzand Will this be landing in the January release by chance? |
I'll put this to high-priority. With the ili9341 merged, this should be possible. ping @fjmolinas, this would be awesome to have! |
I should receive my PineTime in the next few days, I can test this PR as soon as I have it. |
I've got some more code here: https://github.com/kaspar030/pinetime-riot The branch includes a simple module for stdio on the display. It is based on a pre-merged ili9341, though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review, nothing tested so far
boards/pinetime/Makefile.include
Outdated
# for this board, we are using Segger's RTT as default terminal interface | ||
USEMODULE += stdio_rtt | ||
TERMPROG = $(RIOTTOOLS)/jlink/jlink.sh | ||
TERMFLAGS = term_rtt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TERMFLAGS = term_rtt | |
TERMFLAGS = term-rtt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is coppied, others use term_rtt
:
[kaspar@ng riot (add_pinetime_support)]$ gg -i term.rtt
Makefile.include:# TERMFLAGS must be exported for `jlink.sh term_rtt`.
boards/hamilton/Makefile.include:TERMFLAGS = term_rtt
boards/pinetime/Makefile.include:TERMFLAGS = term_rtt
boards/ruuvitag/Makefile.include:TERMFLAGS = term_rtt
boards/thingy52/Makefile.include:TERMFLAGS = term_rtt
dist/tools/jlink/jlink.sh: term_rtt)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it was modified in #12733 to term-rtt
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. fixed
extern "C" { | ||
#endif | ||
|
||
/* move on, nothing to see here */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the GPIO button available on the PineTime here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, done
extern "C" { | ||
#endif | ||
|
||
/* move on, nothing to see here */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I guess this should be extended with the vibrator GPIO as soon as SAUL supports vibrators. This can of course wait for a follow up :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, its there. the vibrator is just a GPIO. On my devkit it worked only when on the cradle, though.
Anyhow, the define should be there now.
#include "cfg_rtt_default.h" | ||
#include "cfg_spi_default.h" | ||
#include "cfg_timer_default.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the battery ADC line be included here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
folo :) done
|
||
# Put defined MCU peripherals here (in alphabetical order) | ||
#FEATURES_PROVIDED += periph_i2c | ||
#FEATURES_PROVIDED += periph_uart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UART is not available on the board right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a debug pin or two that could be repurposed? but yeah, not really.
boards/pinetime/Makefile
Outdated
@@ -0,0 +1,4 @@ | |||
MODULE = board | |||
DIRS = $(RIOTBOARD)/common/nrf52xxxdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this pointed to the nrf52xxxdk
and not nrf52
? Is there some refactoring required in those directories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was re-using the board.c. Anyhow, fixed.
boards/pinetime/Makefile.include
Outdated
TERMFLAGS = term_rtt | ||
|
||
# use shared Makefile.include | ||
include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, including nrf52xxxdk
-files while this is not part of the DK development kits is a bit confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
boards/pinetime/doc.txt
Outdated
|
||
"The PINE64 SmartWatch, dubbed "PineTime", is a product of a community effort for an open source smartwatch in collaboration with wearable RTOS and Linux app developers & communities." | ||
|
||
See https://wiki.pine64.org/index.php/PineTime#PineTime_DevKit_SWD_Probe for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why link a specific section of that page here? Isn't it more safe to link to the top of the page (without #PineTime_DevKit_SWD_Probe
in the url)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, that was an accident.
If I remember correctly that's the branch I based my firmware application on 😆 |
Wow, that's quite advanced! Looking forward to try! |
extern "C" { | ||
#endif | ||
|
||
/* move on, nothing to see here */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the backlight GPIO pins also be included here? As an alternative, maybe it is possible to use PWM on them to have more granular brightness control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I got all those in my pinetime pinetime_display branch, but not very clean. will update soon!
497c267
to
104d0bd
Compare
gpio_init(VIBRATOR, GPIO_OUT); | ||
gpio_init(LCD_BACKLIGHT_LOW, GPIO_OUT); | ||
gpio_init(LCD_BACKLIGHT_MID, GPIO_OUT); | ||
gpio_init(LCD_BACKLIGHT_HIGH, GPIO_OUT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be a good neighbor and disable the vibrator, and both LCD_BACKLIGHT_HIGH
and LCD_BACKLIGHT_MID
with gpio_set(VIBRATOR)
(those pins are active low), preferably before initializing them as output if that is possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 more comments, feel free to ignore if you think these should wait for a follow up.
If I have time this evening I can see if I can also give you a snippet to add config for the SPI flash. |
boards/pinetime/Makefile.features
Outdated
CPU_MODEL = nrf52832xxaa | ||
|
||
# Put defined MCU peripherals here (in alphabetical order) | ||
#FEATURES_PROVIDED += periph_i2c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't have to be commented out anymore now that the I2C config is included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
The PR is now able to directly use the ili9341 if the backlight is enabled. E.g., |
Mind giving #13105 a spin on your PineTime with |
will do. the poor thing is going through a compile_and_test run ATM... |
@bergzand this should be good to go? |
@@ -0,0 +1,7 @@ | |||
# for this board, we are using Segger's RTT as default terminal interface | |||
USEMODULE += stdio_rtt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look at #12724. That would help make things a little cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary if there's no periph_uart feature, which stdio_uart and ethos depend on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
This board is in the same case as the hamilton, so things related to stdio_rtt could be replaced with just:
# use JLink Segger RTT by default
RIOT_TERMINAL ?= jlink
include $(RIOTMAKE)/tools/serial.inc.mk
And add the following in pinetime/Makefile.dep
:
# Use Segger's RTT by default for stdio on this board
DEFAULT_MODULE += stdio_rtt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks weird: include $(RIOTMAKE)/tools/serial.inc.mk
.
The board doesn't have uarts exposed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now that I tried I realized that in master, this doesn't work. ;(
69f9b63
to
e7d34b5
Compare
Tested |
I've done a full compile_and_test run. Many tests seem to run fine, but stdio_rtt output is pretty broken. Those that fail because of lost output actually succeeded (edit unless blacklisted). I've managed to get unittests to pass using this patch (adding an early xtimer_init call and increasing stdio_rtt output buffer size).
Otherwise the tests look fine. The stdio_rtt issues are unrelated to this board. ping @bergzand, do you see more issues? @aabadie, regarding the rtt configuration, IMO #12724 is independent of this PR, right? @fjmolinas please keep an eye on this PR, would be awesome to have the support before fosdem! |
Have you tried compiling
I think you've covered everything from my side. Feel free to squash if the others agree. |
Yes... It didn't seem to help, there were still some output issues. I think we need to take a close look at stdio_rtt at some point. |
If you base your work on #12724 and disable the stdio_rtt module when |
Talked offline, @aabadie is ok with not applying his suggestion. |
e7d34b5
to
2b658c1
Compare
@kaspar030 Murdock has some issues with missing docs for the ILI9341 defines. Feel free to amend directly. |
2b658c1
to
4c0f4da
Compare
Yup, done. Murdock is happy, this needs an ACK! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack!
Al green, Go! |
Nice! |
Thanks everyone! |
Contribution description
I just got the PineTime devkit. It was a breeze to port, from opening the device to hello world took <15minutes. Thanks @aabadie @haukepetersen et al for the nice abstractions there!
For more information about the board, please look here:
https://wiki.pine64.org/index.php/PineTime
edit
This currently only adds the basic board configuration and flashing etc. No drivers are used, yet.
Testing procedure
AFAIK they just started shipping the devkits, so I'm probably the only maintainer who has one.
I'll provide output and test results.
For now, maybe concentrate on the integration.
Issues/PRs references