-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
Add support for Generic NRF52805 #442
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,12 +64,22 @@ void Uart::begin(unsigned long baudrate) | |
|
||
void Uart::begin(unsigned long baudrate, uint16_t /*config*/) | ||
{ | ||
#ifdef NRF52805_XXAA | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be touching code in the SDK? Does that introduce potential upgrade complexity? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question for @sandeepmistry :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It would be better to avoid doing this, as it would be one more thing to manage when updating the SDK. That said if it's the best approach wrapping changes in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Am I good to leave this as-is for now? There is already series and, in some special cases, chip specific logic in the .cpp library files. I would prefer to leave this condition where it is until we decide on the best way/place to extend SDK definitions without modifying the SDK. However, I'll do whatever you feel is best. There is increased interest to get this merged in, so whatever I can do to help expedite. |
||
nrfUart->PSEL.TXD = uc_pinTX; | ||
nrfUart->PSEL.RXD = uc_pinRX; | ||
#else | ||
nrfUart->PSELTXD = uc_pinTX; | ||
nrfUart->PSELRXD = uc_pinRX; | ||
#endif | ||
|
||
if (uc_hwFlow == 1) { | ||
#ifdef NRF52805_XXAA | ||
nrfUart->PSEL.CTS = uc_pinCTS; | ||
nrfUart->PSEL.RTS = uc_pinRTS; | ||
#else | ||
nrfUart->PSELCTS = uc_pinCTS; | ||
nrfUart->PSELRTS = uc_pinRTS; | ||
#endif | ||
nrfUart->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Enabled; | ||
} else { | ||
nrfUart->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Disabled; | ||
|
@@ -175,12 +185,20 @@ void Uart::end() | |
nrfUart->TASKS_STOPTX = 0x1UL; | ||
|
||
nrfUart->ENABLE = UART_ENABLE_ENABLE_Disabled; | ||
|
||
#ifdef NRF52805_XXAA | ||
nrfUart->PSEL.TXD = 0xFFFFFFFF; | ||
nrfUart->PSEL.RXD = 0xFFFFFFFF; | ||
|
||
nrfUart->PSEL.RTS = 0xFFFFFFFF; | ||
nrfUart->PSEL.CTS = 0xFFFFFFFF; | ||
#else | ||
nrfUart->PSELTXD = 0xFFFFFFFF; | ||
nrfUart->PSELRXD = 0xFFFFFFFF; | ||
|
||
nrfUart->PSELRTS = 0xFFFFFFFF; | ||
nrfUart->PSELCTS = 0xFFFFFFFF; | ||
#endif | ||
|
||
rxBuffer.clear(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,7 +256,7 @@ void SPIClass::detachInterrupt() { | |
} | ||
|
||
#if SPI_INTERFACES_COUNT > 0 | ||
#if defined(NRF52_SERIES) | ||
#if defined(NRF52_SERIES) && !defined(NRF52805_XXAA) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 That would make it work on nrf52810 as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done here 1109102 |
||
SPIClass SPI (NRF_SPI2, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI); | ||
#else | ||
SPIClass SPI (NRF_SPI0, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,17 +401,34 @@ void TwoWire::onService(void) | |
} | ||
} | ||
|
||
TwoWire Wire(NRF_TWIM1, NRF_TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL); | ||
#if defined(NRF52805_XXAA) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could also consider There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the NRF52805 has completely different handler names (TWIM0_TWIS0_TWI0_IRQn vs SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn) which was part of the reason for using the board specific logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, sorry for not checking this out before! |
||
|
||
#if WIRE_INTERFACES_COUNT > 0 | ||
extern "C" | ||
{ | ||
void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void) | ||
TwoWire Wire(NRF_TWIM0, NRF_TWIS0, TWIM0_TWIS0_TWI0_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL); | ||
|
||
#if WIRE_INTERFACES_COUNT > 0 | ||
extern "C" | ||
{ | ||
Wire.onService(); | ||
void TWIM0_TWIS0_TWI0_IRQn_IRQHandler(void) | ||
{ | ||
Wire.onService(); | ||
} | ||
} | ||
} | ||
#endif | ||
#endif | ||
|
||
#else | ||
|
||
TwoWire Wire(NRF_TWIM1, NRF_TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL); | ||
|
||
#if WIRE_INTERFACES_COUNT > 0 | ||
extern "C" | ||
{ | ||
void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void) | ||
{ | ||
Wire.onService(); | ||
} | ||
} | ||
#endif | ||
#endif //defined(NRF52805_XXAA) | ||
|
||
#if WIRE_INTERFACES_COUNT > 1 | ||
|
||
|
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.
Based on https://github.com/sandeepmistry/arduino-nRF5/blob/master/cores/nRF5/SDK/components/toolchain/gcc/nrf52805_xxaa.ld
should this be:
?
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 here a60f6db