board: add hamilton board support#9013
Conversation
1982809 to
c080d91
Compare
c080d91 to
5f2ccce
Compare
|
Any review here? |
|
Where to get one of these boards, is it publicly available somewhere? |
|
@MichelRottleuthner, Yes. You can get one from https://hamiltoniot.com/. I sent 5 hamiltons to @emmanuelsearch too. |
276c439 to
ff4defe
Compare
|
Since #8978 was merged, now this PR includes FXOS8700. |
ff4defe to
73a0f78
Compare
MichelRottleuthner
left a comment
There was a problem hiding this comment.
Thank you for this PR! Looks quite clean to me. I only found some minor things, see below. One thing I'm not sure about is the board-specific test application. I think gnerally it's nice to have a test app that makes use of all the boards features but I'm not convinced it actually adds additional value here. Most (if not all) of the things that are done in tests/board_hamilton should already be covered by the saul test, while being easier and more generic (less code; no need for adaption when adding additional sensors).
boards/hamilton/Makefile.dep
Outdated
| @@ -0,0 +1,15 @@ | |||
| ifneq (,$(filter gnrc_netdev_default netdev_default,$(USEMODULE))) | |||
| USEMODULE += at86rf233 | |||
| USEMODULE += auto_init_gnrc_netif | |||
There was a problem hiding this comment.
I think the board itself shouldn't depend on auto_init_gnrc_netif - what if some application wants to use the radio (gnrc_netdev_default) but without auto-init?
There was a problem hiding this comment.
What is a counter example? As saul_default includes "auto_init_saul" for sensor initialization, I think it is very convenient to include "auto_init_gnrc_netif" for radio initialization.
There was a problem hiding this comment.
Yes it is convenient, but it should be upon the application to decide whether to use auto_init or not. Counter example: run grep -r --include "Makefile*" "USEMODULE += auto_init_gnrc_netif" from RIOT root dir and you will see that hamilton is the only board that adds this dependency, all other occurrences are from tests or examples (i.e. applications).
There was a problem hiding this comment.
I changed the code, for consistency. But it is still not clear why "saul_default" includes auto_init in "RIOT-OS/Makefile.dep" but "netdev_default" does not. What is the reason?
boards/hamilton/Makefile.features
Outdated
| FEATURES_PROVIDED += periph_rtt | ||
| FEATURES_PROVIDED += periph_spi | ||
| FEATURES_PROVIDED += periph_timer | ||
| FEATURES_PROVIDED += periph_pm |
There was a problem hiding this comment.
alphabetical order
boards/hamilton/dist/reset.sh
Outdated
| @@ -0,0 +1,18 @@ | |||
| #!/bin/sh | |||
|
|
|||
| # This script resets a CC2538SF53 target using JLink called | |||
boards/hamilton/include/board.h
Outdated
| @@ -0,0 +1,151 @@ | |||
| /* | |||
| * Copyright (C) 2018 UC Berkeley | |||
There was a problem hiding this comment.
For consistency please stick to same format here and above. Also the previous remark stated 2016, are both correct?
boards/hamilton/include/board.h
Outdated
| * | ||
| * @file | ||
| * @brief Board specific definitions for the Hamilton | ||
| * board |
There was a problem hiding this comment.
can go to the line above
| #define PWM_MAX_CHANNELS 2 | ||
| /* for compatibility with test application */ | ||
| #define PWM_0_CHANNELS PWM_MAX_CHANNELS | ||
| #define PWM_1_CHANNELS PWM_MAX_CHANNELS |
There was a problem hiding this comment.
Is this really needed? looks like some old compatibility code to me(?)
There was a problem hiding this comment.
It is true, but no harm to have this just in case, right?
There was a problem hiding this comment.
no harm, but we shouldn't add unnecessary code ;) I think you are safe to remove it here. The use of this define was removed some time ago.
There was a problem hiding this comment.
OK. I resolved the issue. But FYI, samr21-xpro driver also has this part.
cpu/sam0_common/periph/cpuid.c
Outdated
| #include <string.h> | ||
|
|
||
| #include "periph/cpuid.h" | ||
| #include "board.h" |
There was a problem hiding this comment.
It is related because fb_eui64 is defined in board.h.
There was a problem hiding this comment.
sorry, I actually meant the same line in tmp006.h
| uint8_t *out = (uint8_t *)buf; | ||
| memcpy(out, fb_eui64, 8); | ||
| #else | ||
| #if CPUID_LEN |
There was a problem hiding this comment.
use #else if here
sys/luid/luid.c
Outdated
| out[i % len] ^= cid[i]; | ||
| } | ||
| #endif | ||
| #endif |
There was a problem hiding this comment.
when using #else if above, one of the #endif lines can be removed here
| * CORECLOCK = ((PLL_MUL + 1) * 1MHz) / PLL_DIV | ||
| * | ||
| * NOTE: The PLL circuit does not run with less than 32MHz while the maximum PLL | ||
| * frequency is 96MHz. So PLL_MULL must be between 31 and 95! |
|
I don't have a board here to actually test. @emmanuelsearch can you or someone at FU test this on real hardware? Or can you spare one of the five boards you have for some time? (I assume @tcschmidt would be willing to ship it from FU to HAW and back) |
8ce33c8 to
27bf380
Compare
|
@MichelRottleuthner, I reflected most comments. Regarding the test application, I do think that providing a complete test application is good for users to experience full features of the board quickly, without tedious trials and errors. This is to mitigate any misunderstanding and hasty frustration. The hamilton is designed for low-power sensing and wireless reporting, which needs to be shown in this test application. I'm thinking working on this application further to show that hamilton periodically wakes up, senses all information, and broadcasts a packet including the information. The idle current should be ~6uA. If redundancy is only thing that matters, please allow me to maintain this application :) |
drivers/include/tmp006.h
Outdated
| #include <stdint.h> | ||
| #include <stdbool.h> | ||
| #include "periph/i2c.h" | ||
| #include "board.h" |
There was a problem hiding this comment.
This is used for TMP006_USE_LOW_POWER, right? It looks a bit misplaced to me, that the driver of a temperature sensor needs to know something about the board it is used on, except for it's parameters. Is it really needed to define this in board.h? I mean, the board will work without this setting and so will the driver -> this looks application-specific to me. If there really is a good reason to set TMP006_USE_LOW_POWER and TMP006_USE_RAW_VALUES in board.h then these should be handled like the other TMP006_PARAM* values via tmp006_params.h. But then this change should also be introduced by a seperate PR I think.
boards/hamilton/include/board.h
Outdated
| #define FXOS8700_PARAM_ADDR (0x1E) | ||
| #define FXOS8700_PARAM_ACC_RANGE FXOS8700_REG_XYZ_DATA_CFG_FS__8G | ||
| #define FXOS8700_PARAM_RENEW_INTERVAL (1000000ul) | ||
| #define FXOS8700_USE_ACC_RAW_VALUES (0) |
There was a problem hiding this comment.
Is this really needed here? FXOS8700_USE_ACC_RAW_VALUES isn't handled by fxos8700_params.h so overwriting this by the application will not be possible. See my other comment regarding tmp006.h
|
@Hyungsin @MichelRottleuthner the plan was to test this week and integrate in CI in Berlin with @kaspar030 |
I agree on that and I like that you kept an eye on usability/simplicity, but at the moment the application doesn't include something specific to this board, does it? Have you tried the saul test appllication? It should do almost the same as this test app with less code.
Then it may be better to issue a PR once the application has this implemented ;) Edit: maybe the applications repo would be the right place for this specifc app - when placed there you could also add some code to showcase usage of the hamilton cloud service ;) @emmanuelsearch thanks! |
f4b62d4 to
e29be55
Compare
boards/hamilton/include/board.h
Outdated
| #endif | ||
| #ifndef HDC1000_PARAM_RENEW_INTERVAL | ||
| #define HDC1000_PARAM_RENEW_INTERVAL (1000000ul) | ||
| #endif |
|
@MichelRottleuthner, I agree. So I removed the test application and tmp006.h from this PR. |
e29be55 to
d17ff3d
Compare
|
Without #10849 merged, you should use two separate terminals. |
|
Rebased |
|
Hi, sorry for the delay! I'll be responsive now, we could try and get this in for the upcoming release perhaps? |
|
@danpetry, I'm not really sure about this. In my experience, JLink has connection is not always robust... Does turning power off and on before flashing a new app help? |
|
Yes, power cycling of the segger helps (I did this by unplugging and plugging in the usb) but I think we should not require power cycling to re-flash. I just checked with @kaspar030 on his computer/toolchain and he's having similar problems to me. IMO we should solve this so that the support is solid. I'll have a closer look at this and try and isolate the problem. @Hyungsin would you be able to post your Jlink versions and platform (looks like ubuntu 16.04?) Re the removal of auto_init, initially this was to isolate the test code better. As you point out, now we need it for RTT so should put it back in. It's unlikely to have any adverse effects but let's test on a few other selected boards just in case. |
I'm just realizing that this would be fine for tests/shell, but may cause trouble in other tests. |
|
@danpetry, my Ubuntu version is 16.04, JLink Firmware is J-Link V10, and Hardware is V10.10. Thank you for the endeavor! |
|
@danpetry, how is it going? Can we include this PR in the upcoming release? |
|
There is still a change request by @kYc0o - has this been resolved? |
|
@tcschmidt, yes 👍 |
|
|
This is still not working over this side - we've tested on a number of dev machines to make sure it's not something to do with the setup of mine. @Hyungsin I've got exactly the same OS and Jlink versions as you. Looking into this further. |
|
I added a PR that could at least, show when flashing fails with the board instead on returning 0. |
kYc0o
left a comment
There was a problem hiding this comment.
ACK from my side, though I think the testing is not completely done yet.
I am thinking about something as I currently have a similar issue that when It would be a good solution to just disable the auto inclusion of all init functions but still use the requested ones. It would require some refactoring but I think it would still be beneficial when using |
|
I've found that the following sequence of operations works reliably, for w1: If the second and third steps are swapped, no operation is possible, which is why it wasn't working for me before. I.e. pyterm doesn't seem to connect correctly when the program is actually running. @Hyungsin is this the same on your side? @cladmi has raised the point that this doesn't allow running automated tests. i.e. |
|
Here's my assessment of the issues. tl;dr: ACK from me, I'll wait for a day or so before merging in case others want to offer further opinion. auto_init/xtimer make test Both of these issues existed before this PR, and the ruuvitag and thingy52 were merged presumably without tests/shell working, and without |
|
Comment above updated after some offline discussion with @miri64 . ACK from me and I'll wait before merging for a short while as stated. |
|
@danpetry, great! Then should I restore DISABLE=auto_init for the shell test? |
|
@Hyungsin yes, please restore the shell test makefile back to the way it was, squash and rebase. I don't see any blocking comments above so I'll re-test and merge once you've done this :) |
|
@danpetry, done! |
|
Re-tested and merged. Thanks for your patience and your contribution! 💯 |
|
#11341 adds instructions on RTT shell access for all boards that use it |
|
As described above, these issues were pre-existing and so being raised and dealt with outside the scope of this PR. |


This PR provides an initial driver for the Hamilton board [1,2]. @immesys.
Hamilton has samr21e18a SoC (Cortex M0+ CPU and AT86RF233 radio), HDC1080 (temperature and humidity sensors), FXOS8700 (3-axis accelerator and magnetometer), TMP006 (object temperature), APDS9007 (light sensor), Button, LED, and EKMB (PIR motiron sensor). It provides JTAG as the programming/debugging interface. Its idle current is ~6 uA when a 32 kHZ RTC is running.
Some sensors have not been merged yet: APDS9007 (#8989), EKMB (#7823), FXOS8700 (#8978).
Low power clock configuration has not been merged yet: #7826.
Therefore, this PR, as an initial support, provides a test application which tests operation of HDC1080, TMP006, Button, and LED without low idle current.
References
[1] https://bets.cs.berkeley.edu/publications/2017buildsys_hamiltondemo.pdf
[2] https://bets.cs.berkeley.edu/publications/2018sensys_hamilton.pdf