Skip to content
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 Nordic's nRF52810 IC #7915

Merged
merged 9 commits into from
Jun 25, 2018

Conversation

carlescufi
Copy link
Member

@carlescufi carlescufi commented May 25, 2018

Adds support for the IC itself and a new board which enforces the 52810 limitations but mirrors the nRF52 DK hardware, since there is no development kit specific to the 52810.

Tested with the RTT console since UART is not functional yet.

Note that BLE is not functional yet either. We require a new version of nrfx with the appropriate radio bindings and then @cvinayak will be able to add a layer for it in the bluetooth hal folder.

@@ -155,6 +155,8 @@ struct arm_mpu {
#define REGION_1G (0x1D << 1)
#define REGION_2G (0x1E << 1)
#define REGION_4G (0x1F << 1)
#define REGION_24K (0x20 << 1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galak @agross-linaro @ioannisg please review this change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. These macros are used to encode the region size in the MPU register, when configuring MPU regions, and AFAIK, we only have powers of two, there.
Check table B3-43 in ARMv7-M technical reference manual.

@carlescufi
Copy link
Member Author

CC @junqingzou @jarz-nordic @kl-cruz

@codecov-io
Copy link

codecov-io commented May 25, 2018

Codecov Report

Merging #7915 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7915      +/-   ##
==========================================
- Coverage    63.8%   63.78%   -0.02%     
==========================================
  Files         426      426              
  Lines       40890    40890              
  Branches     6921     6921              
==========================================
- Hits        26088    26082       -6     
- Misses      11666    11672       +6     
  Partials     3136     3136
Impacted Files Coverage Δ
.../sched/schedule_api/src/test_priority_scheduling.c 100% <ø> (ø) ⬆️
...nel/sched/schedule_api/src/test_slice_scheduling.c 96.96% <ø> (ø) ⬆️
arch/posix/core/posix_core.c 91.91% <0%> (-7.08%) ⬇️
boards/posix/native_posix/timer_model.c 95.16% <0%> (+1.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b35ed7e...5ca7f05. Read the comment docs.

@@ -0,0 +1,20 @@
# Kconfig.defconfig.nrf52810 - Nordic Semiconductor nRF52832 MCU
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix number

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -0,0 +1,9 @@
# Kconfig - nRF52810 PCA10040 board configuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pca10068 - also correct folder name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, see commit messages for explanation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

#
# SPDX-License-Identifier: Apache-2.0

if BOARD_NRF52810_PCA10040
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too, and everywhere else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way @carlescufi do we really need these empty Kconfig files?

@@ -381,7 +381,7 @@ static int nordicsemi_nrf52_init(struct device *arg)

key = irq_lock();

#ifdef CONFIG_SOC_NRF52832
#if defined(CONFIG_SOC_NRF52832) || defined(CONFIG_SOC_NRF52810)
nordicsemi_nrf52832_init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that both chips shall have different init functions. Most of PANs were fixed in nrf52810

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

"nordic,nrf52810";

chosen {
zephyr,console = &uart0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nrf52810 does not have an UART0, only UARTE0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here UART I think means "serial device"? not the type of hardware, that's defined in the "compatible" tag I believe?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While @carlescufi comment is correct, if its the case that UARTE0 can only be the 'E' form, than the compat in the SOC dts should just be 'nordic,nrf-uarte' and we don't need to update the compat in the board.dts

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already the case that compat in the SoC dts is only nrf-uarte

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then i suppose we are ok.

label = "I2C_0";
};

i2c1: i2c@40004000 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nrf52810 does not have TWIM1.
It has only TWIM0 at address 40003000

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

label = "image-1";
reg = <0x00016000 0xa000>;
};
scratch_partition: partition@20000 {
Copy link
Collaborator

@nvlsianpu nvlsianpu May 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the scratch partition is of the image slot size? The scratch size of 0x3000 will be sufficient here, Then slots size can be increased to size 0xd000 each. So scratch_size/slot_size ~ 0.23, which is near to ratio of nrf52832_pac10040 (0.2).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks

galak
galak previously requested changes May 25, 2018
Copy link
Collaborator

@galak galak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a few dts and other style comments.

@@ -8,7 +8,7 @@
config SOC_SERIES_NRF52X
bool "Nordic Semiconductor nRF52 series MCU"
select CPU_CORTEX_M4
select CPU_HAS_FPU
select CPU_HAS_FPU if !SOC_NRF52810
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, seems like move the 'select CPU_HAS_FPU' over to the SOC_NRF52... would be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

#include <soc.h>

/* Push button switch 0 */
#define SW0_GPIO_PIN 13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this via DTS instead since this is a new board.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to, but I think I would need some help here. Can you give me some pointers?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the following commit:

commit c627de1
Author: Maureen Helm maureen.helm@nxp.com
Date: Thu Apr 19 12:57:18 2018 -0500

boards: Move led and button definitions to dts for kinetis boards

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also need to pull in some changes from PR #7444 (meaning adding the dt nodes for GPIO etc).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very well. In that case I will wait until #7444 is merged, since this should not be merged before 1.12 is released anyway. Thanks for the pointers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@galak this will be fixed as you propose. Only aliases will be kept in the board.h, in compliance with what other boards do.

"nordic,nrf52810";

chosen {
zephyr,console = &uart0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While @carlescufi comment is correct, if its the case that UARTE0 can only be the 'E' form, than the compat in the SOC dts should just be 'nordic,nrf-uarte' and we don't need to update the compat in the board.dts


&uart0 {
status = "ok";
compatible = "nordic,nrf-uarte";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment if this compat should just be in the SoC dtsi

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this line from the board dts file, since it's already in the dtsi


config SOC
string
default nRF52810_QFAA
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this default "nRF52810_QFAA" to avoid generating a warning once this gets in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks

Copy link
Collaborator

@kl-cruz kl-cruz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config file needs rework

// <e> NRFX_SPI_ENABLED - nrfx_spi - SPI peripheral driver
//==========================================================
#ifdef CONFIG_NRFX_SPI
#define NRFX_SPI_ENABLED 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nRF52810 is not equipped with SPI. There are SPIM and SPIS

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a new file, please re-review



#ifndef NRFX_TIMER3_ENABLED
#define NRFX_TIMER3_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no TIMER3 in nRF52810

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a new file, please re-review



#ifndef NRFX_TIMER4_ENABLED
#define NRFX_TIMER4_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no TIMER4 in nRF52810

// <e> NRFX_I2S_ENABLED - nrfx_i2s - I2S peripheral driver
//==========================================================
#ifndef NRFX_I2S_ENABLED
#define NRFX_I2S_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no I2S in nRF52810

// <e> NRFX_LPCOMP_ENABLED - nrfx_lpcomp - LPCOMP peripheral driver
//==========================================================
#ifndef NRFX_LPCOMP_ENABLED
#define NRFX_LPCOMP_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no LPCOMP in nRF52810



#ifndef NRFX_PWM1_ENABLED
#define NRFX_PWM1_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only PWM0 in nRF52810



#ifdef CONFIG_SPI_1_NRF_SPIM
#define NRFX_SPIM1_ENABLED 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only SPIM0 in 52810



#ifndef NRFX_TWIM1_ENABLED
#define NRFX_TWIM1_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only TWIM0 in nRF52810

// <e> NRFX_TWI_ENABLED - nrfx_twi - TWI peripheral driver
//==========================================================
#ifndef NRFX_TWI_ENABLED
#define NRFX_TWI_ENABLED 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no TWI in nRF52810.
This config file needs to be changed

@@ -5,18 +5,29 @@
# SPDX-License-Identifier: Apache-2.0
#

config SOC_NRF52810
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one more difference between nRF52810 and other members of the nRF52 family: The nRF52810 does not have instruction cache, which should be enabled on other SoCs.

At the moment it looks that we are not enabling cache at all. IMHO we should fix that asap as without cache performance is significantly degraded. Please fix that in this PR or create new issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, updated the patches to reflect this

if BOARD_NRF52810_PCA10040

config BOARD
default nrf52810_pca10040
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing quotes here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@carlescufi
Copy link
Member Author

@dbkinder @galak all comments addressed now

@anangl
Copy link
Member

anangl commented Jun 22, 2018

Since #7334 is now in master, "nrfx_config_nrf52810.h" needs one more update: this and this change.
Hence, maybe it would make sense to merge #8525 first and then update commit f85cfce regarding "nrfx_config_nrf52810.h" and "CMakeLists.txt"?

In order to avoid auto-selection by Kconfig, the board needs to define
the specific IC that it contains, in this case an nRF52832.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
@carlescufi
Copy link
Member Author

@anangl addressed, thank you

@carlescufi
Copy link
Member Author

recheck

1 similar comment
@carlescufi
Copy link
Member Author

recheck

carlescufi and others added 8 commits June 22, 2018 18:17
nrfx requires specific chip configuration for each IC. Those are not
upstream in the nrfx repository, but rather part of the Zephyr nrfx
port. Add a configuration for the nRF52810.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Ioannis Glaropoulos <ioannis.glaropoulos@nordicsemi.no>
Since Nordic does not offer an nRF52810 Development Kit and instead
recommends using the nRF52 DK (nRF52832 based), add a board that
enforces the limitations of the nRF52810 but is designed to be flashed
onto the actual nRF52 DK hardware.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Ioannis Glaropoulos <ioannisg.glaropoulos@nordicsemi.no>
When adding the nRF52810, which has 24KB of RAM, some of the tests don't
compile anymore due to lack of SRAM. Address this by either filtering
the test out or reducing the amount of memory allocation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The nRF52810 is a low-cost variant of the nRF52832, with a reduced set
of peripherals and memory. This commit adds basic support for it in the
arch SoC and dts folders.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Ioannis Glaropoulos <ioannis.glaropoulos@nordicsemi.no>
This commit adds a compile-time directive for the
nrf52810_pca10040 board that instruct nRFx to perform
certain board initialization. The directive is needed
as nrf52810_pca10040 mirrors the nrf52832 DK hardware.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit moves the definitions for the LED and Buttons
supported in nrf52810_pca10040 DK in DTS from board.h. Aliases
are kept in board.h to make basic examples pass.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
The commit modifies the I2C-related defines in nrfx
configuration to comply with the updates in (57e3644).
It also modifies the i2c configuration in DTS for board
nrf52810_pca10040 to reflect the nRF52810 capabilities.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit selects HAS_DTS_I2C in nRF8232 DK board definition.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
@carlescufi
Copy link
Member Author

@dbkinder can you revisit this one?

@agross-oss
Copy link
Collaborator

looks good to me

@carlescufi
Copy link
Member Author

@galak @dbkinder will you be able to take a look at this soon? Your requests have been addressed so unless I hear back soon I will need to dismiss the reviews in order to get this merged. Thanks!

@carlescufi
Copy link
Member Author

thanks @dbkinder!

@carlescufi carlescufi dismissed galak’s stale review June 25, 2018 17:34

Requests addressed

@carlescufi carlescufi merged commit fb4befb into zephyrproject-rtos:master Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet