1) You are correct about the ports in mcu.h. Note that there are definitions for this in nrf52_hal.h and they do the correct things (at least I think so). Given that no code that I can see (although I might be looking at something a bit out of date) uses MCU_GPIO_PORTA or PORTB macros on nordic I say that the code should be removed from mcu.h and the definitions in nrf52_hal.h be used instead.
2) Indeed, 4 is too low. I was looking at the spec and there is a setting for 9dBm in the register. The specification does state that 8dBm is the maximum output power but you need to use the setting Pos9dBm. Go figure (there is probably a description of why that is somewhere). So, this definitely should change for the 52840. 3) I have no issue with adding -Warray-bounds Thanks for pointing these out! > On Mar 5, 2018, at 6:35 PM, Abderrezak Mekkaoui <[email protected]> wrote: > > Dear All, > A couple of observations I came across while developing a ble app on the the > nrf52840 preview pdk. Please correct me if I am wrong. > > In the following "defines" (in > ...\apache-mynewt-core\hw\mcu\nordic\nrf52xxx\include\mcu\mcu.h) should not > 16 be 32 as there are 32 pins assigned per port (even if they are not > implemented)? > #define MCU_GPIO_PORTA(pin) ((0 * 16) + (pin)) > #define MCU_GPIO_PORTB(pin) ((1 * 16) + (pin)) > > in ...\apache-mynewt-core\hw\drivers\nimble\nrf52\src\ble_phy.c > #define NRF_TX_PWR_MAX_DBM (4) > NRF_TX_PWR_MAX_DBM should be 8 for the nrf52840. > > To flag an out of bound array indexing I had to add -Warray-bounds to the > compiler flags: > compiler.flags.default: [compiler.flags.base, -O1 -ggdb -Warray-bounds] > Should this be the default? > Thanks > > Abderrezak >
