boards/msbiot: Configured cc110x as default netdev#9124
boards/msbiot: Configured cc110x as default netdev#9124aabadie merged 2 commits intoRIOT-OS:masterfrom
Conversation
aabadie
left a comment
There was a problem hiding this comment.
Thanks for working on this. I think the default parameters management for the cc110x could be better improved than what is proposed here.
See my comment below.
boards/msbiot/Makefile.include
Outdated
|
|
||
| # add driver for CC1101 sub-gigahertz transceiver as default netdev | ||
| ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE))) | ||
| USEMODULE += cc110x |
There was a problem hiding this comment.
indent should be only 2 spaces
There was a problem hiding this comment.
Thanks for the hint. I will fix this. Is there a reason why RIOT uses 4 spaces in C code, but 2 in Makefiles? This seems inconsistent.
I personally use smart tabs 1, 2 for just this reason: You don't need to argue about indent width, because it because an editor option everyone can configure to her/his liking. And if needed, to different width on a per file type bases.
| @@ -0,0 +1,46 @@ | |||
| /* | |||
There was a problem hiding this comment.
A better solution would be to move this file in drivers/cc110x/include then using #ifndef/#define/#endif it will be possible to set default values in the driver code that can be overridden in the boards. The msba2 could also be updated.
See how it's done with at86rf2xx driver and samr21-xpro/iotlab-m3 boards.
There was a problem hiding this comment.
Thanks for the hint. I will update it accordingly.
Btw: Does the cc110x work for those boards? Last time I checked the driver didn't work with either msba2 or msbiot. The driver was developed when spi_acquire was a rather cheap operation of acquiring a mutex, not setting up the SPI bus. Before the SPI API was changed so that spi_acquire also configured the SPI bus, the driver worked on both msba2 and msbiot. So optimizing the driver to call spi_acquire only once at the very beginning of every interaction with the hardware and spi_release at the very end might not only improve performance, but also fix the issue with msba2 and msbiot boards.
|
@aabadie: Thanks for pointing out how to improve the pull request. I believe I have addressed the issues you mentioned now. |
aabadie
left a comment
There was a problem hiding this comment.
Thanks for updating the PR. It's almost there but I still have a few comments. See below.
| * These values are based on the msbiot board | ||
| * @{ | ||
| */ | ||
| #ifndef CC110X_SPI |
There was a problem hiding this comment.
I would call this parameter CC110X_PARAM_SPI, same for other parameters (add _PARAM after CC110X).
| */ | ||
| const cc110x_params_t cc110x_params[] = { | ||
| { | ||
| .spi = CC110X_SPI, ///< SPI bus the cc110x tranceiver is connected to |
There was a problem hiding this comment.
No need for adding doxygen documentation. This struct is already "documented" in the cc110x.h file (I looked at it and it should be updated in a follow PR).
| #ifndef CC110X_GDO2 | ||
| #define CC110X_GDO2 GPIO_PIN(PORT_C, 5) | ||
| #endif | ||
| /** @} */ |
There was a problem hiding this comment.
Please also add a CC110X_PARAMS define, like it's done in at86rf2xx driver. This way it allows a developer to define a global params define for multiple devices. With your change, this is not possible.
boards/msba2/include/board.h
Outdated
| * @name Configure conntect CC1101 (radio) device) | ||
| * @{ | ||
| */ | ||
| #define CC110X_SPI 0 |
boards/msba2/include/board.h
Outdated
| * @{ | ||
| */ | ||
| #define CC110X_SPI 0 | ||
| #define CC110X_CS 53 |
There was a problem hiding this comment.
Those values are weird, is it possible to find something with GPIO_PIN(PORT_NUM, PIN_NUM) ? I know it's out of the scope of this PR, I'm just commenting
There was a problem hiding this comment.
In cpu/lpc2387/include/periph_cpu.h:57 I found this
#define GPIO_PIN(port, pin) (port*32 + pin)So I guess it should be like this
CS = 53 = GPIO_PIN(PORT_B, 21)
GDO0 = 27 = GPIO_PIN(PORT_A, 27)
GDO1 = 55 = GPIO_PIN(PORT_B, 23)
GDO2 = 28 = GPIO_PIN(PORT_A, 28)
I will check this tomorrow on the hardware. Would be nice to have no magic numbers in the code.
There was a problem hiding this comment.
No need to test, this will obviously yield the same value and thus has to be correct.
46fbbf4 to
e671f28
Compare
|
@aabadie: Thanks for your input. Please re-review. I think I addressed all issues now. |
|
@maribu, I allowed myself to push an extra commit in your branch that changes your PR to what I have in mind:
What would be great now is that you squash your commits in 2:
Then it will be perfect. Maybe someone else could also test that the msba2 board is still working (I don't have one). |
|
@aabadie: Done. The reviewing will sadly be a bit problematic:
|
|
I was wrong, sort of: Above when using the original pull request (without moving cc110x_params.h to the driver) over a distance of ~10cm. With the current PR. Over SWD I get the following backtrace: I do believe that the PR does not contain the bug that causes the fatal error, but merely triggers it. But still it might be reasonable to not merge the PR until the cc110x issue is resolved |
+1 |
|
Of course it was an evil typo. After having that fixed, it works again (at least as "good" as before, with 90% loss rate). I will check for the MSBA2 tomorrow as well. But I believe the MSBA2 is not even booting since the update of the SPI API. |
13821e6 to
30a4e41
Compare
|
Hi, I solved the issue with the MSBA2 not booting with the cc110x driver in PR #9154. Once PR #9154 is applied, the cc110x driver works with and without this PR. So I can confirm, that this PR does not break thinks. Below is the output of one of our MSBA2 boards after applying this PR and PR #9154 on top: Kind regards, |
|
|
||
|
|
||
| /** | ||
| * @name CC110X configuration |
There was a problem hiding this comment.
Missed that one. Here it should be @brief and the @{, /** @} */ below can be removed.
- Replaced magic numbers in the CC110X configuration of the MSBA2 with SPI_DEV(x) and GPIO_PIN(x, y) macros - Adjusted implementation of `cc110x_params.h` to match the code of `at86rf2xx` - Made MSBA2's CC110X parameters the default configuration
- Adjusted `#define`s to match the naming convention of `cc110x_params.h` - Enable the `cc110x` module if `netdev_default` or `gnrc_netdev_default` is used
|
Hi, Regarding the MSB IoT: I have figured out some timing issues in the driver. The MSB IoT seems to be faster and enables interrupts on the GDO2 control pin before the CC1101 transceiver applies the new configuration. Because the interrupt triggers on both rising and falling edge, it will can off two times: Let's say the GDO2 signals by falling edge that more data can be uploaded to the TX fifo but the GDO2 was low before, it would have to go high first and later low again. Thus, only the second edge should trigger an interrupt, but the MSB IoT might run the ISR two times. Sadly those timing issues aren't the only problem. It seems the SPI transfer to the MSB IoT is not working completely reliable. I hope to figure that out as well. (It might have to do with how the CS is done.) Maybe I can solve that next weekend. Kind regards, |

Contribution description
boards/msbiot/Makefile.include:
is used
boards/msbiot/include/cc110x_params.h:
Issues/PRs references