Update BLE values while connected

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
pamac_1655886
Level 2
Level 2
First like received

I am not sure about how this works. I have never tried to run a program with BLE before I think.

   

I have a program which I have to update. I modify some things (nothing related with ble behaviour). things like: now this sketch controls 5 motors and it has to control 10, not i has 2 force sensors and it has to control 3... This kind of stuff. BLE file is almost equal.  I just add notifications for new variables.

   

I have a problem when I try to run the program in my pioneer development board (ble version). It hangs and gives an error:

   

"Debugger exited unexpectedly during run. Encountered error (Target disconnected See output window for more information.)"

   

Clicking over Show more details" gives:

   

"There was an unhandled error during the debug session. This has forced the debugger to shutdown. Try again."

   

I am testing it without anything connected. Just to see if it works. So maybe this is the problem and I need to connect everything to make it working.

   

As soon as main function starts, InitializeSystem is called:

   

   

void InitializeSystem(void)
{
    CyGlobalIntEnable;                //Activate mask of interrupts
    CyBle_Start(CustomEventHandler);  //Init BLE and set event handler function
    ADC_IRQ_StartEx(ADC_ISR);         //Interrupt for reading ADC
    isr_button_StartEx(MyISR);
    /*Set vector for WDT interrupt to desired function. This function will be in charge of updating values to be sent by BLE*/
    CyIntSetVector(WATCHDOG_INT_VEC_NUM, &WDT_INT_Handler); 
    InitializeWatchdog();
    OPA_Start();                     //Start OPA
    OPA_Enable();
    ADC_Start();                     //Start ADC
    ADC_StartConvert();
    //CyDelay(1000);
}

   

   

I have read on other post about in the latest version of BLE watchdog is not used. It is used something called BLESS??. Maybe this is the problem. The current version of my software was built with an older version of PSOC and components. And now I updated the whole project to the latest one.

   

My problem is that if I set watchdog as active (in Initialize function), that function never ends. And in case it does, something goes wrong and it crashes.

   

I would want the code to reach this line in main():

   

   

for(;;) {       
        CyBle_ProcessEvents();

   

        ...

   

   

I am developing a pcb to keep all my stuff there but unitl I have it printed, I have to test my code in this board.

0 Likes
1 Solution
Anonymous
Not applicable

Please disable WDT in firmware and try to debug.

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Are you facing the issue only while debugging?  WDT  will reset the device when the debugger stops code execution. This could be the reason debugger is stopping unexpectedly.

0 Likes
pamac_1655886
Level 2
Level 2
First like received

I have just tried debugging. And maybe it happens when I have a break point activated so it could be the reason as you said. Should I comment it while testing then?

0 Likes
Anonymous
Not applicable

Please disable WDT in firmware and try to debug.

0 Likes
ShengY_96
Employee
Employee
10 sign-ins 5 sign-ins Welcome!

Please make sure the settings of .cydwr file:  .cydwr ->System: Debug select: SWD