Undetected Device when add Some code

Hello!
I have developed a simple application to read 2 ADC voltages basically and send them to a central...
I had already finished it and I wanted to add a gpio output that activates a mosfet in my hardware...
I added it as follows:

/****************************************************************************************/
/* LED configuration */
/****************************************************************************************/
#if defined (__DA14531__)
#define GPIO_LED_PORT GPIO_PORT_0
#define GPIO_LED_PIN GPIO_PIN_9
#define ADC_INPUT_PORT GPIO_PORT_0
#define ADC_INPUT_PIN GPIO_PIN_6
#define BRIDGE_CTRL_PORT GPIO_PORT_0
#define BRIDGE_CTRL_PIN GPIO_PIN_11
#else
#define GPIO_LED_PORT GPIO_PORT_1
#define GPIO_LED_PIN GPIO_PIN_0
#endif

And the reservation...

#if DEVELOPMENT_DEBUG

void GPIO_reservations(void)
{
RESERVE_GPIO(LED, GPIO_LED_PORT, GPIO_LED_PIN, PID_GPIO);
RESERVE_GPIO(BRIDGE_W, BRIDGE_CTRL_PORT , BRIDGE_CTRL_PIN, PID_GPIO);


/*
i.e. to reserve P0_1 as Generic Purpose I/O:
RESERVE_GPIO(DESCRIPTIVE_NAME, GPIO_PORT_0, GPIO_PIN_1, PID_GPIO);
*/

#if defined (CFG_PRINTF_UART2)

I then use my GPIO output as follows in "user_cuts1_impl.c":

void app_adcval1_timer_cb_handler()
{
struct custs1_val_ntf_ind_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_NTF_REQ,
prf_get_task_from_id(TASK_ID_CUSTS1),
TASK_APP,
custs1_val_ntf_ind_req,
DEF_SVC1_ADC_VAL_1_CHAR_LEN);
// Disable the Extended Sleep Mode so ADC can work as expected
arch_set_sleep_mode(ARCH_SLEEP_OFF);
GPIO_SetActive(BRIDGE_CTRL_PORT, BRIDGE_CTRL_PIN); //ACTIVE BRIDGE CURRENT
//DELAY
// ADC value to be sampled


//new
/* Perform single ADC conversion */

uint16_t result = gpadc_read();
uint16_t adc_val_mv = gpadc_sample_to_mv(result);
//A PARTIR DEL ADC CONVERTIR PERO EN aNDROID A TEMPERATURA Y MOSTRAR
//float adc_val_V= adc_val_mv/1000.0;
//float Rmedida= (adc_val_V/(Vref/2))*R_ref;
//float Temp= (Rmedida / R0_PT1000 -1.0) / alpha_PT1000;
//uint16_t Final_temp= (uint16_t) Temp;
contador++;
if(contador >= 10){
contador=0;
}
//Enable the Extended Sleep mode again for better current consumption
GPIO_SetInactive(BRIDGE_CTRL_PORT, BRIDGE_CTRL_PIN); //INACTIVE BRIDGE CURRENT
arch_set_sleep_mode(ARCH_EXT_SLEEP_ON);

//req->conhdl = app_env->conhdl;
req->handle = SVC1_IDX_ADC_VAL_1_VAL;
req->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN;
req->notification = true;
/*Change the value updated with adc_val_mv */


memcpy(req->value, &adc_val_mv, DEF_SVC1_ADC_VAL_1_CHAR_LEN); //replace "sample" for value required

ke_msg_send(req);

if (ke_state_get(TASK_APP) == APP_CONNECTED)
{
// Set it once again until Stop command is received in Control Characteristic
timer_used = app_easy_timer(APP_PERIPHERAL_CTRL_TIMER_DELAY, app_adcval1_timer_cb_handler);
}
}

I didn't really add or do anything else....
I thought that by some hardware error I had damaged my DA14531MOD, so I changed it and the new one let me program it the first time and when I tried to read it again to program it, again the message "undetected" appears in flash programmer... I tried with a hardware where I only have the DA14531MOD and the programming pins without more components and the same thing happens, the first time it detects it and lets it program, but after loading the program the same thing happens:

I am really worried since I discarded one module because I thought I had damaged it and I would only have one left to continue....
I don't know if maybe I have some conceptual error with gpioreservations or what happens in memory when uploading my code? I appreciate your help... Thank you.

Parents
  • Hi Miguel_elec,

    After I checked the datasheet and your earlier questions, some tips below hope them helps:

    1, please confirm the SWD interface have no conflicts with P0_11

    2, Indeed P0_11 truly a normal GPIO. it is free to use. Reference 7. General Purpose Output — DA145XX Tutorial SDK Getting started (renesas.com) for detail. I am not sure you have configured this pin by GPIO_ConfigurePin(LED_PORT, LED_PIN, OUTPUT, PID_GPIO, false).

    3, Check your schematic again and make sure P0_11 is normally configured.

    4, Can keil set up a connection?

    If it still stacked, please share the schematic with me for more details.

    PS: please close the sleepmode for test or mount/unmount your battery.

    BR,

    JH_Renesas

  • Hi JH_Renesas... Thank you for reply...

    This is the Schematic's part related to P0_11 and SWD:

    If i search "BRIDGE" with CTRL+F there isnt more labels with this name i.e it looks like there isnt conflict with SWDIO and SWCLK pins... The same with SWDIO and SWCLK CTRL+F searching...

    As i said, when I did the test with another new pcb without components, but only with programming pins and the ble module, the same thing happened... So I ruled out any additional hardware problem.

    Im using DA14531-00FCDEVKT-U development kit...

     I have not had this problem before in any of my tests or programming attempts.

    IS THERE ANY WAY TO RESET THE INTERNAL MEMORY OR FLASH TO RESET MY DEVICE AND CONTINUE WITH MY DESIGN? THANK YOU SO MUCH... 

  • Hi Miguel_elec,

    The schematic you have shown above, the P0_2 is configured to Rx, so it's the problem.

    solution: Using 1-Wire UART via SmartSnippets Toolbox, to download FW.

    same solution: here

    reference design here

    thanks

    JH_Renesas

  • JH_Renesas thank you very much for your reply....


    RX was only optional on my hardware, finally I'm not using it at all neither in software nor in hardware.... However I am hoping that by programming it by 1via UART it will read my device and finally I can load the FW, I will be working on it and any concerns I will let you know... I have the DA14531-00FCDEVKT-U development kit for that purpose...
    Best regards

Reply
  • JH_Renesas thank you very much for your reply....


    RX was only optional on my hardware, finally I'm not using it at all neither in software nor in hardware.... However I am hoping that by programming it by 1via UART it will read my device and finally I can load the FW, I will be working on it and any concerns I will let you know... I have the DA14531-00FCDEVKT-U development kit for that purpose...
    Best regards

Children
No Data