nRF5x icon indicating copy to clipboard operation
nRF5x copied to clipboard

Hardware without XTAL and without DCDC

Open ericlangel opened this issue 5 years ago • 4 comments

Hello,

i have a NRF52832 Module without 32.768kHz X'tal and without DCDC. But the Redbear examples doesn't work at all. The Nordic Support said there are config headers which have to be changed to the right clock source and power source.

So which files have to be changed to use internal LDO and RC oscillator?

i found the "device.h" file and changed the Clock_Src to 4, but this doesn't help. /* NRF_LF_SRC_XTAL 2 NRF_LF_SRC_SYNTH 3 NRF_LF_SRC_RC 4 */ #define MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC 4

where i can find the Power settings?

I hope someone can help me

ericlangel avatar Oct 10 '18 12:10 ericlangel

@ericlangel You can try this one and see if it works. I just took the redbear dfu bootloader example project from this repository and adapted for no external 32.768Khz xtal. Compiled it using the free mdk arm version (code size limited - but it's sufficient to do your work in this case) and added in the bsp/pca10040.h header file this define at the end where's the other one with xtal:

#define NRF_CLOCK_LFCLKSRC_NO_XTAL      {.source        = NRF_CLOCK_LF_SRC_RC, \
                                         .rc_ctiv       = 16,                   \
                                         .rc_temp_ctiv  = 4,                     \
                                         .xtal_accuracy = 0}

then I used the new define for the clock source config in the main.c file:

...
static void ble_stack_init(bool init_softdevice)
{
    uint32_t         err_code;
    sd_mbr_command_t com = {SD_MBR_COMMAND_INIT_SD, };
    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC_NO_XTAL;

    if (init_softdevice)
...

I made it available here for testing. It's the compiled hex file including the required softdevice also (used the mergehex Nordic's utility.) You need to replace the SoftdeviceS132_2.0_SDK11_Bootloader_20161221.hex file with this one where Arduino keeps it for the redbear package which is usually in: ${HOME}/.arduino15/packages/RedBear/hardware/nRF52832/0.0.2/bootloaders/ on Linux and on Windows it should be here C:\Users\<your_account>\AppData\Local\Arduino15\packages\RedBear\hardware\nRF52832\0.0.2\bootloaders and burn it using the Arduino IDE's Burn Bootloader menu. After that you can use the normal upload for sketches as usual.

I tested the shared bootloader hex file from above on a nrf52832 based module which has an external 32.768 xtal crystal and it worked - this proves that it works as it should select to use the internal RC oscillator even though it has the external crystal.

Regarding the dc-dc internal converter - the bootloader has no dependency on the hardware side. What I mean here is that even if you have the required external components for the dc-dc converter to operate or not it still should boot up. The dc-dc converter can be enabled on the software side and it will operate if the external components are present - if not then it should work without it.

mtiutiu avatar Nov 14 '18 13:11 mtiutiu

I also created a PR for this one.

mtiutiu avatar Nov 14 '18 14:11 mtiutiu

Hello mtiutiu,

thank you for your reply. I will test it the next days. After posting this issue i got a possible work around from Nordic.

in the "device.h" in ...\RedBear\hardware\nRF52832\0.0.2\cores\RBL_nRF52832\mbed_os\targets\TARGET_NORDIC\TARGET_NRF5\TARGET_MCU_NRF52832\TARGET_NRF52_DK

there is the definition for the LF Clock

/**

  • @brief NRF_LF_SRC_XTAL 2
  •    NRF_LF_SRC_SYNTH 3 
    
  •    NRF_LF_SRC_RC    4
    

*/ #define MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC 2 #define MBED_CONF_NORDIC_UART_HWFC 0 #define MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE 9600

with the SYNTH Clock selected i got my Application running. But not with the RC Clock. And i had to use the original Softdevice 2.0.0 from Nordic. With the Redbear Softdevice it didnt work.

ericlangel avatar Nov 15 '18 07:11 ericlangel

Great. Well in my case I used a PTR5518 module which is nrf51822 based and without the LF XTAL mounted nor with the required external components for the DC-DC converter. It didn't worked with the redbear standard bootloader obviously but after modifying it as explained in my previous comment it started to work like a charm without doing other changes related to this Arduino nRF5x core.

I also created a PR for this one but I don't think it will get approved because I don't think it will be of interest for @ChiHung or RedBear company from obvious reasons.

mtiutiu avatar Nov 15 '18 10:11 mtiutiu