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

  • Hi again!

    I understand that my development kit has a DA14531, and I am able to program it and use it to program other devices like my DA14531MOD.

    I configured SmartSnippetToolbox with a single UART (p0_5) on my dev kit. When I go to "flash code," click "connect," and then press the reset button, it seems like the device is detected. Subsequently, I go to the flash programmer app, and the device is detected. I upload the code successfully, but the code doesn't seem to work...I erase memory after programming in toolbox. When I use the template advertising, the SmartBond doesn't find anything. Additionally, when I try to load the firmware from the toolbox, I am not sure about the configuration of the image HEX file. Could you help me? Do you know what is happening?

    Adittionaly my pcb DA14531MOD yet is not detected... I have a push button and when i push it, the reset pin receives high voltage logical... but it hasnt a pull down resitor... is it mandatory? I'm connecting :

    DEV kit to DA14531MOD

    VCC(3v) to VBAT

    GND to GND

    RST PIN (its the same SWDIO when i programming by SWD) to P0_5.

    Is it okay? i need more pins to connect with this specifically dev kit? any hardware modification?

    I programmed the dev kit from Keil too, and the same issue occurs. It's the same template I used some months ago, but it appears not to be advertising. Is there any possibility that the "bootloader" or internal program used to program other devices from the dev kit is wrong or corrupted?

  • Hi Miguel_elec,

    Thanks for your info here.

    1, 

    2, about the kit you can find more docs here including schematics and User Guide.

    A FTDI UART cable is recommended. If you want use kit to flash, make sure the DA14531 on the kit has been bypassed.

    Thanks 

    JH_Renesas

  • Hi JH_Renesas,

    I finally managed to erase the memory of my devices to get them out of the error that leaves them in "undetected" state, I did not know that it was not so immediate with my dev kit to program via 1 Uart... I don't know what you mean when you say that the module must be bypassed to use it as a programmer?

    1) Any specific resistor configured?Maybe R18?

    Anyway I did it using a FTDI UART programmer, as you recommended... When I was about to give up, I put the 1Kohm resistor between Rx and Tx and everything worked!


    2) I still have one final big problem that I would be grateful if you could help me solve.... My original finished code with which I started this conversation to which I only added in GPIO functionality and the whole problem started, now it doesn't work...

    When I loaded it in the DA14531MOD it returned to the "undetected" status and did not advertise... I solve the undetected error rebuilding with this option:

      

    I have already detected the line of code that damages the program (it does not advertise or do anything) when I put it in:

    Is this pin reserved for other thing? i am working on ble_app_periph ...

    Than you...

Reply
  • Hi JH_Renesas,

    I finally managed to erase the memory of my devices to get them out of the error that leaves them in "undetected" state, I did not know that it was not so immediate with my dev kit to program via 1 Uart... I don't know what you mean when you say that the module must be bypassed to use it as a programmer?

    1) Any specific resistor configured?Maybe R18?

    Anyway I did it using a FTDI UART programmer, as you recommended... When I was about to give up, I put the 1Kohm resistor between Rx and Tx and everything worked!


    2) I still have one final big problem that I would be grateful if you could help me solve.... My original finished code with which I started this conversation to which I only added in GPIO functionality and the whole problem started, now it doesn't work...

    When I loaded it in the DA14531MOD it returned to the "undetected" status and did not advertise... I solve the undetected error rebuilding with this option:

      

    I have already detected the line of code that damages the program (it does not advertise or do anything) when I put it in:

    Is this pin reserved for other thing? i am working on ble_app_periph ...

    Than you...

Children
  • Hi Miguel_elec,

    Thanks for your info here.

    The GPIO P0_11 does not been configured by other internal functions indeed.

    Q: Does your code run normally when you rebuilt the target. I do all the configuration like you do in the ble_app_peripheral project on the evb, nothing wrong with advertising and connection.

    And the GPIO_ConfigurePin should been called during the initializing progress.

    And indeed, the rebuilding button may resolve issues while function linking has errors.

    Making a Beyond Compare between your project and SDK6, if there are any clues can be found.

  • Thanks, now it's working as expected... I just renamed los #define for shorter names and rearranged the initializations.