Mbed on nina b1

Sir,
After run
#include “mbed.h”

DigitalOut myled(LED1);

int main() {
while(1) {
myled = 1;
wait(0.1);
myled = 0;
wait(0.1);
printf(“hello”);
}
}

[env:nrf52_dk]
platform = nordicnrf52
board = ublox_evk_nina_b1
framework = mbed

Does printf send data to wich NINA B pin ?

Can you verify ?

What does the PinNames.h header say about standard UART pins?

The is not to ev nina b1
look
C:\Users\tcpipchip.platformio\packages\framework-mbed\targets\TARGET_ublox\TARGET_HI2110\TARGET_SARA_NBIOT
Only Sara! :frowning:

Maybe is fflush problem!, i can see that there is a big delay to send the data out!

Solved
#include “mbed.h”
#include “stdio.h”

DigitalOut myled(LED1);

int main() {
while(1) {
myled = 1;
wait(1.0);
myled = 0;
wait(1.0);
printf(“hello from Miguel wisintainer\r”);
fflush(stdout);
}
}

CTS RTS must be short circuited

Where is that file ?

Just put #include "PinNames.h" in your IDE and follow the symbol. Takes you to framework-mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/TARGET_UBLOX_EVK_NINA_B1/PinNames.h

Says right there

    // Nordic SDK pin names
    RX_PIN_NUMBER = p5,
    TX_PIN_NUMBER = p6,
    CTS_PIN_NUMBER = p7,
    RTS_PIN_NUMBER = p31,
    STDIO_UART_TX = TX_PIN_NUMBER,
    STDIO_UART_RX = RX_PIN_NUMBER,
    STDIO_UART_CTS = CTS_PIN_NUMBER,
    STDIO_UART_RTS = RTS_PIN_NUMBER,
    I2C_SDA0 = p2,
    I2C_SCL0 = p3,
    // mBed interface pins
    USBTX = TX_PIN_NUMBER,
    USBRX = RX_PIN_NUMBER

You can also add the object

Serial pc(USBTX, USBRX, "serial", 115200);

to your main.cpp and call printf() on that object to make sure it’s using those pins.

And about Analog, do you have a good example to mbed nina b ? With full analog setup ?

#include “mbed.h”
#include “stdio.h”
#include “pinNames.h”

DigitalOut myled(LED1);

AnalogIn ain(A0);

int main() {

while(1) {
    myled = 1;
    wait(1.0);
    myled = 0;
    wait(1.0);
    float f=ain.read_u16();
    printf("%f\r",f);
    printf("hello from Miguel wisintainer\r");
    fflush(stdout);
}

}

This example only read the analog, but i cant see the analog setup ?

What do you mean by ‘analog setup’.

Good morning
I mean for example , to config the resolution, gain, etc!

It’s implemented in mbed-os/analogin_api.c at master · ARMmbed/mbed-os · GitHub with config values coming from mbed-os/sdk_config.h at master · ARMmbed/mbed-os · GitHub.

If you want a different config call nrf_drv_saadc_init and nrf_drv_saadc_channel_init again, I guess.

1 Like