You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: targets/TARGET_NORDIC/TARGET_NRF5x/README.md
+67-13Lines changed: 67 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@ First, create a new entry in `mbed-os/targets/targets.json` using the template b
10
10
"inherits": [""],
11
11
"release_versions": ["5"],
12
12
"device_name": ""
13
-
},
13
+
}
14
14
}
15
15
```
16
16
17
-
Where `target_name` is the name of the new target, `inherits` can be either `MCU_NRF52832` or `MCU_NRF52840`, and `device_name` is the ID specifying actual RAM and flash size, for example, `nRF52832_xxAA` and `nRF52840_xxAA`. The `release_version` specifies that the target is compatible with Mbed OS 5.
17
+
Where `target_name` is the name of the new target, `inherits` can be either `MCU_NRF52832` or `MCU_NRF52840`, and `device_name` is the ID specifying actual RAM and flash size, for example, `nRF52832_xxAA` and `nRF52840_xxAA`. The `release_version` specifies that the target is compatible with Mbed OS 5.
18
18
19
19
This entry enables the new target in the Mbed OS build system.
20
20
21
-
Next, add optional target specific configuration in `mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/mbed_lib.json`.
21
+
Next, add optional target specific configuration in `mbed-os/targets/TARGET_NORDIC/TARGET_NRF5x/mbed_lib.json`.
22
22
23
23
```json
24
24
{
@@ -40,11 +40,11 @@ The optional configuration includes specifying errata fixes specific for the MCU
40
40
LF clock source configuration is used for MCU startup initialization and the BLE SoftDevice LF clock configuration (if BLE libraries is used). Advanced configurations are used only for the BLE SoftDevice LF clock configuration.
41
41
42
42
Default clock source is XTAL oscillator. There are three options that can be configured as the clock source:
43
-
- NRF_LF_SRC_XTAL
44
-
- NRF_LF_SRC_RC
45
-
- NRF_LF_SRC_SYNTH
43
+
- NRF_LF_SRC_XTAL
44
+
- NRF_LF_SRC_RC
45
+
- NRF_LF_SRC_SYNTH
46
46
47
-
Set `lf_clock_src` to what is most suitable for the target. This value can later be overridden by the user application if necessary.
47
+
Set `lf_clock_src` to what is most suitable for the target. This value can later be overridden by the user application if necessary.
48
48
49
49
50
50
## Mbed HAL Implementation Details
@@ -62,15 +62,15 @@ When instantiating a new Mbed SPI object or I2C object, the object will be assig
62
62
63
63
1. The driver will look up the pins in the configuration table and pick a pre-assigned instance.
64
64
1. If the pins can't be found in the configuration table, the driver will check if a hardware instance has already been assigned to those pins so that objects using the same pins will share the same instance.
65
-
1. If no instance has been assigned, the driver will look for a free instane. For I2C objects instances are assigned from 0 to 1. For SPI objects instances are assigned from 2 to 0. This ensures that no matter the order of instantiation the first three objects can be guaranteed to be on separate instances no matter the pins being used.
65
+
1. If no instance has been assigned, the driver will look for a free instane. For I2C objects instances are assigned from 0 to 1. For SPI objects instances are assigned from 2 to 0. This ensures that no matter the order of instantiation the first three objects can be guaranteed to be on separate instances no matter the pins being used.
66
66
1. If no unused instance can be found, objects not sharing any pins will be assigned to the same default instance, which is `Instance 0` for I2C and `Instance 2` for SPI.
67
67
68
68
#### Customization
69
69
70
70
A custom configuration table can be provided by overriding the weakly defined default empty table. In the example below, I2C objects using pins `p1` and `p2` for `SDA` and `SCL` will always be assigned to `Instance 1` and SPI objects using pins `p3`, `p4`, `p5` for `MOSI`, `MISO`, and `CLOCK` will be assigned to `Instance 2` and SPI objects using pins `p6`, `p7`, and `p8` will be assigned to `Instance 0`. The custom configuration table must always be terminated with a row of `NC`.
71
71
72
72
```
73
-
const PinMapI2C PinMap_I2C[] = {
73
+
const PinMapI2C PinMap_I2C[] = {
74
74
{p1, p2, 1},
75
75
{NC, NC, NC}
76
76
};
@@ -86,7 +86,7 @@ The tables must be placed in a C compilation file.
86
86
87
87
#### Concurrency
88
88
89
-
1. When called from the same thread, it is safe to assign I2C and SPI objects to the same instance.
89
+
1. When called from the same thread, it is safe to assign I2C and SPI objects to the same instance.
90
90
1. If an instance is being used exclusively for either I2C or SPI, the objects can safely be called from multiple threads.
91
91
1. If an instance is being used for both I2C and SPI, the user must provide thread safety between the objects.
92
92
@@ -99,7 +99,7 @@ The serial implementation uses the UARTE module which works exclusively through
99
99
1. Rx DMA buffer, pre-loaded in EasyDMA for automatic switchover.
100
100
1. Rx FIFO buffer, for serving data to the application.
101
101
102
-
When the first DMA buffer is full or flushed the interrupt handler will automatically copy the DMA buffer to the FIFO buffer. This happens in interrupt context to avoid data loss and with UARTE interrupts set at the highest priority. The FIFO buffer is backed by the Nordic atomic fifo, which can be read and written to safely without disabling interrupts.
102
+
When the first DMA buffer is full or flushed the interrupt handler will automatically copy the DMA buffer to the FIFO buffer. This happens in interrupt context to avoid data loss and with UARTE interrupts set at the highest priority. The FIFO buffer is backed by the Nordic atomic fifo, which can be read and written to safely without disabling interrupts.
103
103
104
104
#### Customization
105
105
@@ -128,7 +128,7 @@ All DMA buffers are the same size and must be at least 5 bytes due to hardware r
128
128
For the NRF52840, UARTE instances are assigned based on pins and calling order. Serial objects with the same pin configurations will go to the same instance. A custom configuration table can be provided by overriding the weakly defined default empty table. In the example below, serial objects using pins `p1` and `p2` for `Tx` and `Rx` will always be assigned to `Instance 1` and serial objects using pins `p3` and `p4` for `Tx` and `Rx` will be assigned to `Instance 0` regardless of calling order. The custom configuration table must always be terminated with a row of `NC`.
129
129
130
130
```
131
-
const PinMapI2C PinMap_UART[] = {
131
+
const PinMapI2C PinMap_UART[] = {
132
132
{p1, p2, 1},
133
133
{p3, p4, 0},
134
134
{NC, NC, NC}
@@ -149,5 +149,59 @@ The RTC2 ISR is set at the lowest interrupt priority to ensure that UARTE interr
149
149
* The UARTE hardware only supports 8-bit, None/Even parity, and 1 stop bit.
150
150
* The asynchronous read and write implementation currently only support 255 byte transfers.
151
151
* The EasyDMA hardware can only read from RAM, which means all Tx buffers must reside in RAM. If a Tx buffer residing in flash is passed to the asynchronous write function, the function will try to copy the Tx buffer to a temporary internal buffer and transmit the data from there.
152
-
* It is not possible to do an asynchronous write from flash and receive non-asynchronously at the same time since the non-asynchronous receive buffer is being used as the temporary transmission buffer.
152
+
* It is not possible to do an asynchronous write from flash and receive non-asynchronously at the same time since the non-asynchronous receive buffer is being used as the temporary transmission buffer.
153
+
154
+
## SoftDevice
155
+
156
+
SoftDevices are treated as bootloaders and automatically combined by the tools. Available SoftDevices:
* TARGET_SOFTDEVICE_S140_OTA (SoftDevice only, for firmware updates)
165
+
* TARGET_SOFTDEVICE_S140_MBR (MBR only, for bootloader builds)
166
+
* TARGET_SOFTDEVICE_NONE
167
+
168
+
NRF52832 uses the S132 SoftDevice and NRF52840 uses the S140 SoftDevice.
169
+
170
+
The X_OTA and X_MBR binaries are obtained from the original X_FULL SoftDevice by splitting it in an MBR part and a SoftDevice part. The MBR is needed for the bootloader and the SoftDevice for firmware updates.
171
+
172
+
### Changing SoftDevice
173
+
174
+
By default, all applications are built with the FULL SoftDevice. This can be changed by modifying the application's `mbed_app.json` configuration file.
0 commit comments