Skip to content

Commit b3b68bc

Browse files
Naveen KajeCruz Monrreal II
authored andcommitted
NRF52 : Fix UART RTS initialization
The preprocessor based macro check #if evaluates all enums as 0 and hence the code does not get compiled. Since move this to a runtime check where the pin variable can be correctly evaluated. Delete mbed_overrides.c as it has a target specific mbed_sdk_init() to resolve linking problem. This is a follow on patch to: #8046
1 parent c87f44e commit b3b68bc

File tree

6 files changed

+15
-28
lines changed

6 files changed

+15
-28
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ typedef enum {
141141
USBRX = RX_PIN_NUMBER,
142142
STDIO_UART_TX = TX_PIN_NUMBER,
143143
STDIO_UART_RX = RX_PIN_NUMBER,
144+
STDIO_UART_CTS = CTS_PIN_NUMBER,
145+
STDIO_UART_RTS = RTS_PIN_NUMBER,
144146

145147
SPI_PSELMOSI0 = p23,
146148
SPI_PSELMISO0 = p24,

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_DELTA_DFBM_NQ620/mbed_overrides.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_MTB_UBLOX_NINA_B1/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ typedef enum {
121121
RTS_PIN_NUMBER = p31,
122122
STDIO_UART_TX = TX_PIN_NUMBER,
123123
STDIO_UART_RX = RX_PIN_NUMBER,
124+
STDIO_UART_CTS = CTS_PIN_NUMBER,
125+
STDIO_UART_RTS = RTS_PIN_NUMBER,
124126

125127
I2C_SDA = p2,
126128
I2C_SCL = p3,

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_RBLAB_BLENANO2/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ typedef enum {
132132
RTS_PIN_NUMBER = p2,
133133
STDIO_UART_TX = TX_PIN_NUMBER,
134134
STDIO_UART_RX = RX_PIN_NUMBER,
135+
STDIO_UART_CTS = CTS_PIN_NUMBER,
136+
STDIO_UART_RTS = RTS_PIN_NUMBER,
135137

136138
// mBed interface Pins
137139
USBTX = TX_PIN_NUMBER,

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_UBLOX_EVA_NINA/PinNames.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ typedef enum {
8686
RTS_PIN_NUMBER = p31,
8787
STDIO_UART_TX = TX_PIN_NUMBER,
8888
STDIO_UART_RX = RX_PIN_NUMBER,
89+
STDIO_UART_CTS = CTS_PIN_NUMBER,
90+
STDIO_UART_RTS = RTS_PIN_NUMBER,
8991

9092
I2C_SDA0 = p2,
9193
I2C_SCL0 = p3,

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/reloc_vector_table.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,13 @@ void nrf_reloc_vector_table(void)
113113
#endif
114114
}
115115

116-
#if (STDIO_UART_RTS != NC)
116+
117117
void mbed_sdk_init(void)
118118
{
119-
gpio_t rts;
120-
gpio_init_out(&rts, STDIO_UART_RTS);
121-
/* Set STDIO_UART_RTS as gpio driven low */
122-
gpio_write(&rts, 0);
119+
if (STDIO_UART_RTS != NC) {
120+
gpio_t rts;
121+
gpio_init_out(&rts, STDIO_UART_RTS);
122+
/* Set STDIO_UART_RTS as gpio driven low */
123+
gpio_write(&rts, 0);
124+
}
123125
}
124-
#endif

0 commit comments

Comments
 (0)