-
Notifications
You must be signed in to change notification settings - Fork 3k
Add nRf52840 target #3841
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 nRf52840 target #3841
Conversation
test results IAR:
test results ARMCC:
test results GCC_ARM (4.9 and 5.4):
|
@JanneKiiskila Client broken for this PR? Can you have a look? or tag someone who could help |
For mbed-os 5.4 you must use the oob-branch for the client - available in; ARMmbed/mbed-os-example-client#190. Yes, the mbed-client-c / coap / NSSDL re-structuring causes a break. |
/** | ||
* Register the next tick. | ||
*/ | ||
static void register_next_tick() { |
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.
Please fix formatting in the HAL files if its similar to this one.
should be:
static void register_next_tick()
{
\\body
}
// the RTC1 keeps running. | ||
// This code is very short 20-38 cycles in the worst case, it shouldn't | ||
// disturb softdevice. | ||
__disable_irq(); |
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.
can't use here critical section?
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.
It's inherited form [NRF5] port. I do not want to change this.
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.
Please update this for all nRF hal integrations to use mbed_critical_section_enter ... mbed_critical_section_exit
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.
Did you mean core_util_critical_section_enter instead of mbed_critical...?
@@ -0,0 +1,537 @@ | |||
/* | |||
* Copyright (c) 2013 Nordic Semiconductor ASA |
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.
2017 in the new fileS or 2016 as I noticed some files were commited in that year?
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.
Is based on the copy of the [NRF5] ports which was committed in such dates.
PinName mosi, PinName miso, PinName sclk, PinName ssel) | ||
{ | ||
int i; | ||
for (i = 0; i < SPI_COUNT; ++i) { |
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.
Is here an intention to init all spi ? Should not be just to init the one that is being invoked on (obj argument) ?
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.
This function infantilize only one instance of SPI driver+hardware (https://github.com/nvlsianpu/mbed/blob/nRF52840_target/targets/TARGET_NORDIC/TARGET_NRF5/spi_api.c#L291). This function assign phisical SPI for input object arg (https://github.com/nvlsianpu/mbed/blob/nRF52840_target/targets/TARGET_NORDIC/TARGET_NRF5/spi_api.c#L289).
|
||
nrf_uart_int_disable(UART_INSTANCE, NRF_UART_INT_MASK_RXDRDY | | ||
NRF_UART_INT_MASK_TXDRDY); | ||
#if DEVICE_SERIAL_ASYNCH |
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 be:
// preprocessor in the line beginning
#if AAAAA
//code here
#endif
Look at travis failure please :
|
What is tested by mentioned target_test.py? It looks like I have to add a description to: |
To make exporters work, yes please add them. To answer the question about this script file |
@0xc0170 Client isn't compiling because |
I''ll rebase it onto latest master. |
33a7943
to
463349b
Compare
What with .\tools\arm_pack_manager\index.json . Was it generated automatically? I'm sure that It's needed to add nRF52840_xxAA device inside it (incorporated in https://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/NordicSemiconductor.nRF_DeviceFamilyPack.8.11.1.pack) Propose of update this: nvlsianpu#2 |
@nvlsianpu Try |
@nvlsianpu When was that pack published? |
@theotherjimmy The pack was published around week 50, 2016. On my machine attempt to update indicates errors and hangs:
|
#endif | ||
|
||
gpio_mask_t m_gpio_initialized; | ||
gpio_cfg_t m_gpio_cfg[GPIO_PIN_COUNT]; |
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.
These two could be marked as "static".
|
||
static gpio_irq_handler m_irq_handler; | ||
static uint32_t m_channel_ids[GPIO_PIN_COUNT] = {0}; | ||
gpio_mask_t m_gpio_irq_enabled; |
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.
This could be marked as "static".
|
||
void gpio_mode(gpio_t *obj, PinMode mode) | ||
{ | ||
MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT); |
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.
It should be <, not <=. But since the pin number is checked in gpio_init(), perhaps it would be better to replace this line with MBED_ASSERT(obj->pin != (PinName)NC);
to keep consistency with gpio_read() and gpio_write().
|
||
void gpio_dir(gpio_t *obj, PinDirection direction) | ||
{ | ||
MBED_ASSERT(obj->pin <= GPIO_PIN_COUNT); |
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.
see gpio_mode()
|
||
#include "port_api.h" | ||
#include "pinmap.h" | ||
#include "gpio_api.h" |
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.
This seems to be unnecessary here.
} | ||
break; | ||
case PIN_OUTPUT: | ||
for (i = 0; i<31; i++) { |
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.
see PIN_INPUT case
|
||
#define FPU_EXCEPTION_MASK 0x0000009F | ||
|
||
void sleep(void) |
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.
This function should be renamed to hal_sleep() to reflect the recent changes in sleep_api.h.
} | ||
} | ||
|
||
void deepsleep(void) |
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.
This function should be renamed to hal_deepsleep() to reflect the recent changes in sleep_api.h.
|
||
void deepsleep(void) | ||
{ | ||
sleep(); |
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.
This should be hal_sleep().
// alternative source of RTOS ticks. | ||
#if defined(TARGET_MCU_NRF51822) | ||
|
||
#include "toolchain.h" |
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.
This should be updated to mbed_toolchain.h.
I'm done with changes. @0xc0170 @theotherjimmy : It's possible that you will update |
What's needed? |
@0xc0170 What I's needed to update is described in description of nvlsianpu#2 |
@theotherjimmy It (
Replacing
|
@theotherjimmy Can you help with the above? #3841 (comment) |
Travis failure, please fix:
|
@theotherjimmy n Could you fix this problem with |
#3931 fixed your |
(it's merged) |
…whitelisting for SD API 3 and further
- bad number of pin from nRF52840 , - bad type of mask of gpio for nRF52940 - typo (object.h) - revert abort func. to spi_master driver - update twi_master driver to the newest (e8527f65e90eee6a4dd48ca55d3fc051a556320a master SDK nRF5)
- fix typso, renaming, repharse commnets. - fix alghoritm of white/id lists setup functions in nRF5xGap class.
Gap::setAddress implementation Gap::getPermittedTxPowerValues implemnetation
- whitelistin setup modifies identitiy flag and omits address' type.
- 128 bits service's UUID discovered by a GATT client was shifted. - not possible to connect while being scanning. - not possible to scanning while being connected. for sd >= 3 whitelisting is now setups into setWhitelist method - Gap::setAddress could failed - Gap::getWhitelist wron implemenation
…d_stack@IAR by increasing heap size for IAR. Corected initial MSP for ARMCC.
…te reads and writes (the latter are used in I2CEeprom module used in CI tests, and this caused that tests-i2c-api were failing). These operations (single byte transfers) are not possible to achieve with the driver from nrf5 SDK (nrf_drv_twi), so the new implementation uses TWI HAL only.
corrected spi_init() to properly handle re-initialization… ARMmbed#3842
Change path of include from '\' to '/', which works on linux as well.
4e15eff
to
c78f73c
Compare
@theotherjimmy, @c1728p9 thanks. I rebased the PR branch against master. Exporter's patch solves the travis error. cc @0xc0170 @pan- |
…ble_irq/__disable_irq
Thanks @nvlsianpu. I restarted jenkins CI as the failure was hw related, waiting now for all CI to complete /morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Ports for Upcoming Targets 3841: Add nRf52840 target ARMmbed/mbed-os#3841 3992: Introducing UBLOX_C030 platform. ARMmbed/mbed-os#3992 Fixes and Changes 3951: [NUCLEO_F303ZE] Correct ARDUINO pin ARMmbed/mbed-os#3951 4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK ARMmbed/mbed-os#4021 3979: KW24D: Add missing SPI defines and Arduino connector definitions ARMmbed/mbed-os#3979 3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the ARMmbed/mbed-os#3990 4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 ARMmbed/mbed-os#4003 4012: STM32: Correct I2C master error handling ARMmbed/mbed-os#4012 4020: NUCLEO_L011K4 remove unsupported tool chain files ARMmbed/mbed-os#4020 4065: K66F: Move bss section to m_data_2 Section ARMmbed/mbed-os#4065 4014: Issue 3763: Reduce heap allocation in the GCC linker file ARMmbed/mbed-os#4014 4030: [STM32L0] reduce IAR heap and stack size for small targets ARMmbed/mbed-os#4030 4109: NUCLEO_L476RG : minor serial pin update ARMmbed/mbed-os#4109 3982: Ticker - kl25z bugfix for handling events in the past ARMmbed/mbed-os#3982
Description
Introduce NRF52840_DK target. It include support for nRF52840 SoC basing on nRF5 SDK v 13. Source codes of new target are on path https://github.com/nvlsianpu/mbed/tree/nRF52840_target/targets/TARGET_NORDIC/TARGET_NRF5_SDK13 and https://github.com/nvlsianpu/mbed/tree/nRF52840_target/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5_SDK13. Code was developed on base (driver implementation, BLE port) of previous targets/TARGET_NORDIC/TARGET_NRF5 (so it's planed to move at last nRF52832 target to introduced code base).
target board web: http://www.nordicsemi.com/eng/Products/nRF52840-Preview-DK
requested mbedls support: ARMmbed/mbed-ls#160
Status
READY
Code review recommendations:
Be aware of that is based on the copy of the [NRF5] ports (on path https://github.com/nvlsianpu/mbed/tree/nRF52840_target/targets/TARGET_NORDIC/TARGET_NRF5). It is recommended rather to review differences between both implementation than only pulled code.