-
Notifications
You must be signed in to change notification settings - Fork 2k
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
samr21: implemention of transceiver via spi #1997
samr21: implemention of transceiver via spi #1997
Conversation
@@ -0,0 +1,4 @@ | |||
ifneq (,$(filter defaulttransceiver,$(USEMODULE))) | |||
USEMODULE += at86rf231 | |||
USEMODULE += transceiver |
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 you just need to use the transceiver
module if the netdev
is not available. You could do something like this:
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += at86rf231
ifeq (,$(filter netdev_base,$(USEMODULE)))
USEMODULE += transceiver
endif
endif
Hi @Troels51, first of all, very nice work! Sorry for putting quite a few comments in your code. I think the overall SPI driver is in a very good state, most remarks are rather minor structuring things. I would suggest you put out the fixes to the GPIO driver as separate PR. Important to understand about the low-level driver concept is, that the SPI and GPIO parts should be completely independent. The SPI driver should only care about MISO, MOSI and SCLK pins. All other pins should be simply configured as standard GPIO devices for the GPIO driver. The radio driver will then take care of using these GPIOs... |
SPI_0_SCLK_DEV.PMUX[(SPI_0_SCLK_PIN % 32) / 2].bit.PMUXE = 5; | ||
SPI_0_MISO_DEV.PMUX[(SPI_0_MISO_PIN % 32) / 2].bit.PMUXO = 5; | ||
SPI_0_MOSI_DEV.PMUX[(SPI_0_MOSI_PIN % 32) / 2].bit.PMUXE = 5; | ||
|
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.
Maybe you can avoid the modulo- and division operations by definig distinct configurations in the periph_conf.h like @haukepetersen said
I really like this PR and will test it soon! |
|
||
int spi_init_slave(spi_t dev, spi_conf_t conf, char (*cb)(char)) | ||
{ | ||
/* TODO */ |
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.
Even if you did not implement the SPI slave, could you also "implement" spi_transmission_begin
(like spi_init_slave
) because the SPI test includes this..
In cpu's with a different endian from the transceiver the short would be reversed right? |
How do you send? When interacting directly with the RIOT transceiver you have to specify the destination address in network byte order. (see |
It came about when i was trying out the rpl_udp example, i could only receive multicasts before trying to reverse the network order. Could it be that the byte order of the address is reversed at another point and i'm just correcting it? |
@Troels51 do you know how to use default exemple with shell functionnalities ? Have you ever managed to do this ? |
@maxencechotard Hmm, i just tried the default example (i should probably have tried it before) and it only works without reversing the byte orders, so reversing is not the solution. But when trying the rpl_udp i can only get messages through when using HTONS on the addresses, so the problem must be somewhere else. |
I post here about the GPIO and EIC. @Troels51 I tried the source code by configuring an interrupt on SW0. Here is what I did: |
Ok I found your error. You just need to call : |
@Troels51 please address @bapclenet's comment and rebase so we can merge this one. |
@Troels51 Could really do with this merge. Let me know if there's anything I could do to help. I have 15 of these boards lying around gathering dust. |
@Troels51, I found another weird behaviour. Even if it works after enable it for the second time, the interrupt which is raised after enabling the interruption shouldn't occur. What do you think about that? PS: I've got the same problem with RTC's interruption |
f8d9111
to
bff54e6
Compare
@@ -463,8 +465,8 @@ int gpio_init_int(gpio_t dev, gpio_pp_t pullup, gpio_flank_t flank, gpio_cb_t cb | |||
gpio_config[extint].arg = arg; | |||
|
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.
Clear the interrupt flag of the given GPIO:
EIC->INTFLAG.reg = EIC_INTFLAG_EXTINTX;
Ok, I found how to solve your problem: |
@bapclenet I implemented the change you suggested, do you think that solves the problem you were having? it seems weird that it is connected with the RTC |
@saurabh984 Sorry for being a bit slow, i've been focused on some school work. You could pull the changes from my branch directly to see how it works. |
Yes that was the same problem. They are not connected but the interruption system is similar in both component. (INTFLAG,INTENTSET and INTENTCLR) |
So you have to clear the flag before you can enable the interrupt? |
Yes, the same as you. I don't know why the flag is set to 1 before renabling the interrupt but this solution works. |
9f332a3
to
449c4dd
Compare
@Troels51 could you address @N8Fear's #1997 (comment) and squash? I'd say we are good to go then. Travis failing for stm32f0discovery and riot_and_cpp seems unrelated. |
88c2e05
to
33ef43c
Compare
Added the newline and squashed the commmits |
Perfect. |
Travis passed, code looks good, tested and works. Let's do this. ACK & Go |
samr21: implemention of transceiver via spi
Congratulations. |
Implementaion of the at86rf231 driver for the samr21 chip this include