-
Notifications
You must be signed in to change notification settings - Fork 7.4k
NRF52 SPI master for new SPI API #5670
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
NRF52 SPI master for new SPI API #5670
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5670 +/- ##
=======================================
Coverage 53.28% 53.28%
=======================================
Files 424 424
Lines 40729 40729
Branches 7845 7845
=======================================
Hits 21702 21702
Misses 15817 15817
Partials 3210 3210 Continue to review full report at Codecov.
|
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.
tiny comments
drivers/spi/spi_nrf52_master.c
Outdated
|
||
if ((config->cs != NULL) || (cfg->psel.cs == CS_UNUSED)) { | ||
/* Disable HW based CS */ | ||
spim->PSEL.CSN |= SPIM_PSEL_CSN_CONNECT_Msk; |
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 spi_context_cs_configure() missing here?
drivers/spi/spi_nrf52_master.c
Outdated
|
||
ret = spi_context_wait_for_completion(&data->ctx); | ||
|
||
spi_context_release(&data->ctx, ret); |
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.
you could move that line before return ret, so line 225 would be move as line 222. but it's cosmetic
drivers/spi/spi_nrf52_master.c
Outdated
u32_t tx_count, struct spi_buf *rx_bufs, u32_t rx_count, | ||
bool asynchronous, struct k_poll_signal *signal) | ||
{ | ||
int ret; |
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.
usually, pre-assigned variable declaration come first, so here ret would be the last
@@ -14,7 +14,7 @@ config SOC | |||
|
|||
config NUM_IRQS | |||
int | |||
default 46 | |||
default 48 |
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.
you commit message does not say why you increase this number (and how it relates to spi actually)
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.
updated commit message to indicate number was increased as per documentation
The lower number of interrupts was causing a build error as the last SPI device has number 47
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 have also introduce device tree support for SPI
@@ -60,6 +60,7 @@ | |||
#define NRF52_IRQ_RTC2_IRQn 36 | |||
#define NRF52_IRQ_I2S_IRQn 37 | |||
#define NRF52_IRQ_FPU_IRQn 38 | |||
#define NRF52_IRQ_SPIM3_IRQn 47 |
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 come from Device Tree
de9d0f8
to
0fadbd5
Compare
updated code after testing |
@galak added initial attempt for dts |
Addresses NRF52 SPI master part of #4713 |
@vanwinkeljan I know @anangl is preparing to submit a driver based on |
I'm trying to get this to build for nrf52_pca10040 by adding the following to hello_world's prj.conf:
I get a lot of warnings and errors: https://gist.github.com/mbolivar/13d9da829fd5d0d6501c604fc0380d29 Am I missing something? |
@mbolivar I will have a look at it. For now I know there is a problem for SPI0 if I switch to SPI1 I do not seen the warnings. One further remark is that you will also need to add a DTS overlay (nrf52_pca10040.overlay) to the hello_world directory that enables the SPI port and declares which pins it will use. |
Increased the number of interrupts from 46 to 48 according to nrf52840 documentation. Signed-off-by: Jan Van Winkel <[email protected]>
Added NRF52 SPI master using new SPI API. Signed-off-by: Jan Van Winkel <[email protected]>
Added DTS support for NRF52 master SPI driver Signed-off-by: Jan Van Winkel <[email protected]>
1eba990
to
78577b1
Compare
@mbolivar this should fix your build issues |
@vanwinkeljan looks like the PR from @anangl (#6458) got taken in #5921 -- earlier @carlescufi mentioned this code as a potential place to work together. Any comments on where you want this PR to go? Sorry that I haven't gotten around to re-testing, as the patches in 6458 did the trick for me. |
NRF52 SPI Master implementation following new SPI API.
Based on legacy NRF52 SPIM driver.