4 Replies Latest reply on Nov 8, 2016 9:42 PM by yans

    Update BLE values while connected

    pmartinez_1655886

      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:

         

      [code]

         

      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);
      }

         

      [/code]

         

      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():

         

      [code]

         

      for(;;) {       
              CyBle_ProcessEvents();

         

              ...

         

      [/code]

         

      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.