This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Custom nRF5340 - No Bluetooth?

We have designed a custom board based on the NRF5340 with the following pinout. Everything flashes without error using the sample rpmsg image for the netcpu and the sample peripheral_ht for the appcpu but I cannot seem to get the bluetooth to work. I have also attached our board.c file for our custom board. Is there something obvious that I'm missing here? Let me know if there's any additional information that I can provide that would help. 

/*
 * Copyright (c) 2018 Nordic Semiconductor ASA.
 *
 * SPDX-License-Identifier: Apache-2.0
 */


#include <zephyr.h>
#include <init.h>
#include <hal/nrf_power.h>
#include <drivers/gpio.h>
#include <logging/log.h>


LOG_MODULE_REGISTER(board_control, 3);


static int init(struct device *dev)
{
    int err=0;
    struct device *p0;
    struct device *p1;

    nrf_power_dcdcen_set(NRF_POWER, true);
    nrf_power_dcdcen_vddh_set(NRF_POWER, false);

    p0=device_get_binding(DT_GPIO_P0_DEV_NAME);
    if(!p0) {
        LOG_ERR("GPIO device " DT_GPIO_P0_DEV_NAME " not found!");
        return -EIO;
    }

    p1=device_get_binding(DT_GPIO_P1_DEV_NAME);
    if(!p1) {
        LOG_ERR("GPIO device " DT_GPIO_P1_DEV_NAME " not found!");
        return -EIO;
    }

    // Standby output to LED driver
    err=gpio_pin_write(p0, 0x00, 1);
    if(err) return 0x00;
    err=gpio_pin_configure(p0, 0x00, GPIO_DIR_OUT | GPIO_DS_DISCONNECT_LOW);
    if(err) return 0x00;

    // Unused
    err=gpio_pin_configure(p0, 0x01, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x01;

    // Debug uart TX
    err=gpio_pin_write(p0, 0x02, 0);
    if(err) return 0x02;
    err=gpio_pin_configure(p1, 0x02, GPIO_DIR_OUT);
    if(err) return 0x02;

    // Debug uart RX
    err=gpio_pin_configure(p0, 0x03, GPIO_DIR_IN);
    if(err) return 0x03;

    // Unused
    err=gpio_pin_configure(p0, 0x04, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x04;

    // Unused
    err=gpio_pin_configure(p0, 0x05, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x05;

    // Unused
    err=gpio_pin_configure(p0, 0x06, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x06;

    // Unused
    err=gpio_pin_configure(p0, 0x07, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x07;

    // Unused
    err=gpio_pin_configure(p0, 0x08, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x08;

    // SCL open-drain line
    err=gpio_pin_configure(p0, 0x09, GPIO_DIR_IN | GPIO_DS_DISCONNECT_HIGH);
    if(err) return 0x09;

    // Unused
    err=gpio_pin_configure(p0, 0x0A, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x0A;

    // Unused
    err=gpio_pin_configure(p0, 0x0B, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x0B;

    // Unused
    err=gpio_pin_configure(p0, 0x0C, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x0C;

    // CHG LED input
    err=gpio_pin_configure(p0, 0x0D, GPIO_DIR_IN);
    if(err) return 0x0D;

    // Unused
    err=gpio_pin_configure(p0, 0x0E, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x0E;

    // Unused
    err=gpio_pin_configure(p0, 0x0F, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x0F;

    // Output to enable battery input to ADC
    err=gpio_pin_write(p0, 0x10, 0);
    if(err) return 0x10;
    err=gpio_pin_configure(p0, 0x10, GPIO_DIR_OUT | GPIO_DS_DISCONNECT_LOW);
    if(err) return 0x10;

    // Unused
    err=gpio_pin_configure(p0, 0x11, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x11;

    // Unused
    err=gpio_pin_configure(p0, 0x12, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x12;

    // TXD to GPS
    err=gpio_pin_write(p0, 0x13, 1);
    if(err) return 0x13;
    err=gpio_pin_configure(p0, 0x13, GPIO_DIR_OUT);
    if(err) return 0x13;

    // Unused
    err=gpio_pin_configure(p0, 0x14, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x14;

    // RX from GPS
    err=gpio_pin_configure(p0, 0x15, GPIO_DIR_IN);
    if(err) return 0x15;

    // Unused
    err=gpio_pin_configure(p0, 0x16, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x16;

    // Unused
    err=gpio_pin_configure(p0, 0x17, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x17;

    // CS to memory chip, active-low
    err=gpio_pin_write(p0, 0x18, 1);
    if(err) return 0x18;
    err=gpio_pin_configure(p0, 0x18, GPIO_DIR_OUT);
    if(err) return 0x18;

    // Unused
    err=gpio_pin_configure(p0, 0x19, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x19;

    // DO from memory chip
    err=gpio_pin_configure(p0, 0x1A, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x1A;

    // Unused
    err=gpio_pin_configure(p0, 0x1B, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x1B;

    // Battery ADC input
    err=gpio_pin_configure(p0, 0x1C, GPIO_DIR_IN);
    if(err) return 0x1C;

    // Unused...eventually COEX1
    err=gpio_pin_configure(p0, 0x1D, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x1D;

    // Unused
    err=gpio_pin_configure(p0, 0x1E, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x1E;

    // Unused
    err=gpio_pin_configure(p0, 0x1F, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x1F;


    /***************END OF P0******************/

    // Unused
    err=gpio_pin_configure(p1, 0x00, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x20;

    // Unused
    err=gpio_pin_configure(p1, 0x01, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x21;
    
    // SDA open-drain line
    err=gpio_pin_configure(p1, 0x02, GPIO_DIR_IN | GPIO_DS_DISCONNECT_HIGH);
    if(err) return 0x22;

    // Unused
    err=gpio_pin_configure(p1, 0x03, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x23;

    // IMU interrupt input
    err=gpio_pin_configure(p1, 0x04, GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH);
    if(err) return 0x24;

    // Unused
    err=gpio_pin_configure(p1, 0x05, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x25;

    // FDI to memory chip
    err=gpio_pin_write(p1, 0x06, 0);
    if(err) return 0x26;
    err=gpio_pin_configure(p1, 0x06, GPIO_DIR_OUT);
    if(err) return 0x26;

    // Unused
    err=gpio_pin_configure(p1, 0x07, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x27;

    // FCK to memory chip
    err=gpio_pin_write(p1, 0x08, 0);
    if(err) return 0x28;
    err=gpio_pin_configure(p1, 0x08, GPIO_DIR_OUT);
    if(err) return 0x28;

    // Unused
    err=gpio_pin_configure(p1, 0x09, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x29;

    // Unused
    err=gpio_pin_configure(p1, 0x0A, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x2A;

    // Unused
    err=gpio_pin_configure(p1, 0x0B, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x2B;

    // Unused
    err=gpio_pin_configure(p1, 0x0C, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x2C;

    // Unused
    err=gpio_pin_configure(p1, 0x0D, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x2D;

    // Unused
    err=gpio_pin_configure(p1, 0x0E, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x2E;

    // Unused
    err=gpio_pin_configure(p1, 0x0F, GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);
    if(err) return 0x2F;


    LOG_INF("Board configured.");

    return 0;
}


SYS_INIT(init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);

Pin

Function

P0.00

Standby output LED driver

P0.01

Unused

P0.02

Debug UART TX

P0.03

Debug UART RX

P0.04

Unused

P0.05

Unused

P0.06

Unused

P0.07

Unused

P0.08

Unused

P0.09

SCL open drain

P0.10

Unused

P0.11

Unused

P0.12

Unused

P0.13

Charge LED input

P0.14

Unused

P0.15

Unused

P0.16

Output enable battery to ADC

P0.17

Unused

P0.18

Unused

P0.19

TX to GPS

P0.20

Unused

P0.21

RX from GPS

P0.22

Unused

P0.23

Unused

P0.24

CS memory, active low

P0.25

Unused

P0.26

DO memory

P0.27

Unused

P0.28

Battery ADC input

P0.29

Unused

P0.30

Unused

P0.31

Unused

P1.00

Unused

P1.01

Unused

P1.02

SDA open drain

P1.03

Unused

P1.04

IMU interrupt input

P1.05

Unused

P1.06

FDI memory

P1.07

Unused

P1.08

FCK memory

P1.09

Unused

P1.10

Unused

P1.11

Unused

P1.12

Unused

P1.13

Unused

P1.14

Unused

P1.15

Unused

Parents
  • You need to change from using the external LFXO to the internal RC Oscillator.

    With menuconfig:

    Top -> Device Drivers -> Hardware clock controller support ---> [*] NRF Clock controller support -> 32 KHz clock source -> (X) RC Oscillator
                                                                                                                                                   -> [*] Enable LF clock calibration
                                                                                                                                                   -> (X)32KHz Clock accuracy -> 251 ppm to 500ppm

    Leave the calibration settings as they are. 

    Do this for both application and hci_rpmsg. 

Reply
  • You need to change from using the external LFXO to the internal RC Oscillator.

    With menuconfig:

    Top -> Device Drivers -> Hardware clock controller support ---> [*] NRF Clock controller support -> 32 KHz clock source -> (X) RC Oscillator
                                                                                                                                                   -> [*] Enable LF clock calibration
                                                                                                                                                   -> (X)32KHz Clock accuracy -> 251 ppm to 500ppm

    Leave the calibration settings as they are. 

    Do this for both application and hci_rpmsg. 

Children
Related