Printf issue very strange behavior on nrf52840

Hello everyone, I am writing this post to ask for help regarding a strange issue with printf.
I’m using mbedos 6.8 and mbed studio 1.3.1.
The board that I use is no longer supported by mebedos 6.x (while it was supported in mbed os 5).
https://github.com/makerdiary/nrf52840-mdk
However the board uses the well-known mcu nrf52840.

So I have edited some json file:

custom_targets.json

{

"NRF52840_MDK": {  
    "inherits": ["MCU_NRF52840"],  
    "components_remove": ["QSPIF"],  
    "overrides": {  
        "lf_clock_src": "NRF_LF_SRC_SYNTH"  
        
    },
    "device_name": "nRF52840_xxAA",
    "detect_code": ["0230"] 

}  

}

targets.json
I have added :
,
“NRF52840_MDK”: {
“inherits”: [
“MCU_NRF52840”
],
“macros_add”: [
“CONFIG_GPIO_AS_PINRESET”
],
“config”: {
“enable-objects-extensions”: {
“help”: “Enable inclusion of objects_extensions.h”,
“value”: false
}
},
“supported_application_profiles”: [
“full”, “bare-metal”
]
},

mbed_lib.json
I have added the lines:

,
“NRF52840_MDK”:{
“platform.stdio-baud-rate”: 9600,
“platform.stdio-convert-newlines”: true
}

and finally accordinng to board pinout I have created a folder (copied from nrf52840_dk) : mbedos\targets\TARGET_NORDIC\TARGET_NRF5x\TARGET_NRF52\TARGET_MCU_NRF52840\TARGET_NRF52840_MDK
and i have modify the lines:

**LED1    = p23,**

** LED2 = p22,**
** LED3 = p24,**

** BUTTON1 = p32,**
** //BUTTON2 = p12,**
** //BUTTON3 = p24,**
** //BUTTON4 = p25,**

**RX_PIN_NUMBER  = p19,**

** TX_PIN_NUMBER = p20,**
CTS_PIN_NUMBER = p7,
RTS_PIN_NUMBER = p5,

// mBed interface Pins
**USBTX = TX_PIN_NUMBER,**

** USBRX = RX_PIN_NUMBER,**
** STDIO_UART_TX = TX_PIN_NUMBER,**
** STDIO_UART_RX = RX_PIN_NUMBER,**
STDIO_UART_CTS = CTS_PIN_NUMBER,
STDIO_UART_RTS = RTS_PIN_NUMBER,

at this point I write my first blinking program and it work! well fine. now i try to use the serial with the printf/scanf so I write a very simple code as:

#include “mbed.h”

DigitalOut led_red(LED1);

#define BLINKING_RATE 500

int main()
{

while (true) {

    wait_us(BLINKING_RATE*1000);
    led_red=!led_red;
    printf("Hello world!\n");

}

}

and I use putty or mbed serial monitor (9600,8,1) but the result is similar some time all work fine but often a couple of lines are written correctly and then everything stops like:

Hello world!
Hello world!
Hello world!
He

some time if I open putty i view daplink:overflow

Based on your experience what can I do? Is correct how I defined the pinnames? Any setting in the json files? The daplink to update? What am I doing wrong?

thank you
Marco