Debugging my nrf5sdk code using vs code via make file

I want to use this command nrfjprog --program .\nrf52840_xxaa.hex --sectorerase

and I had this error any idea about how to fix this?


Parsing image file.

WARNING: A programming operation has been performed without --verify.
WARNING: Programming can fail without error.

Parents Reply Children
  • Hi,

     

    Q1: Are you using SoftDevice timeslot API in your application?

    Q2: Are you disabling/enabling global interrupts in your application?

     

    Kind regards,

    Håkon

  • I'am using bleutooth and an interruption based on a timer

    maby this code can help 

    static void imutimerhandler(void *p_context) {
      //idle_state_handle();

      //greenledon();
      //nrf_delay_ms(10000);
      //greenledoff();
      //nrf_delay_ms(10000);

      //  senduart(Pressure_Temperature);
      nrfx_rtc_counter_clear(&rtc);
      nrf_delay_ms(1);
      timer = nrfx_rtc_counter_get(&rtc);
      if (gyroAvailable()) // alias IMU.gyroscopeAvailable
      {

        readGyro(&gx, &gy, &gz);
        NRF_LOG_INFO("Gyroscope Information ");
       NRF_LOG_FLUSH();
        NRF_LOG_RAW_INFO(" gx: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(gx));
        NRF_LOG_RAW_INFO(" gy: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(gy));
        NRF_LOG_RAW_INFO(" gz: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(gz));
        while (go<6){
       ghw[go+3]=ax;
      ghw[go+4]=ay;
      ghw[go+5]=az;
      go=go+4;}
     
       

        NRF_LOG_FLUSH();
      }

      if (accelAvailable()) // alias IMU.accelerationAvailable in library version 1.01
      {

        readAccel(&ax, &ay, &az);

        NRF_LOG_INFO("Acceleration Information ");
        NRF_LOG_FLUSH();
        NRF_LOG_RAW_INFO(" ax: " NRF_LOG_FLOAT_MARKER, NRF_LOG_FLOAT(ax));
        NRF_LOG_RAW_INFO(" ay: " NRF_LOG_FLOAT_MARKER, NRF_LOG_FLOAT(ay));
        NRF_LOG_RAW_INFO(" az: " NRF_LOG_FLOAT_MARKER, NRF_LOG_FLOAT(az));
         while (go<6)
      {
        ghw[go]=ax;
      ghw[go+1]=ay;
      ghw[go+2]=az;
      ghw[go+3]=ax;
      go=go+4;}
      if (go>5){for (i=0;i<6;i++)
          NRF_LOG_RAW_INFO("table:" NRF_LOG_FLOAT_MARKER,NRF_LOG_FLOAT(ghw[i]));}
     
     

        MotionVariable = (uint16_t)((ax * ax + ay * ay + az * az) * 1000);
        NRF_LOG_INFO("Motion Variable : %d ,", MotionVariable);

        NRF_LOG_FLUSH();

        NRF_LOG_FLUSH();
      }
      if (magnetAvailable()) // alias IMU.magneticFieldAvailable in library version 1.01
      {

        //readMagnet(&mx, &my, &mz);
        //NRF_LOG_INFO("Magnet Information ");
        //NRF_LOG_FLUSH();
        //NRF_LOG_RAW_INFO(" mx: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(mx));
        //NRF_LOG_RAW_INFO(" my: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(my));
        //NRF_LOG_RAW_INFO(" mz: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(mz));
        //NRF_LOG_RAW_INFO("\n\r");
        //NRF_LOG_FLUSH();
      }

      update(-gx, -gy, -gz, ax, ay, az, -mx, my, mz); //EVEN WITH this combination you have to add a - to the pitch to match the previous HAKIM
      computeAngles();

      //NRF_LOG_RAW_INFO(" yaw: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(yaw));
      //NRF_LOG_RAW_INFO(" pitch: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(pitch));
      //NRF_LOG_RAW_INFO(" roll: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(roll));
      //NRF_LOG_RAW_INFO("\n\r");

      position.alpha = (int16_t)roll;
      position.beta = (int16_t)pitch;
      position.gamma = (int16_t)yaw;

      //NRF_LOG_INFO(" alpha : %d  | Beta : %d , ", position.alpha, position.beta);
      //NRF_LOG_INFO("");
      //NRF_LOG_RAW_INFO(" q0: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(q0));
      //NRF_LOG_RAW_INFO(" q1: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(q1));
      //NRF_LOG_RAW_INFO(" q2: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(q2));
      //NRF_LOG_RAW_INFO(" q3: " NRF_LOG_FLOAT_MARKER , NRF_LOG_FLOAT(q3));

      //NRF_LOG_RAW_INFO("\n\r");
      hakim.position = position;
      hakim.body_long = globalDistance;
      CalculPosition_from_mpu(&position);
      Hakim_calcul_distance_to_nose();
      finalDepth = initpressure(&Temp);
      if (initialKalman == 0) {
        Xe = finalDepth;
        initialDepthForKalman = finalDepth;
        initialKalman = 1;
      }

      Pc = Pk + varProcess;
      G = Pc / (Pc + varVolt); // kalman gain
      Pk = (1 - G) * Pc;
      Xp = Xe;
      Zp = Xp;
      Xe = G * (finalDepth - Zp) + Xp; // Result = Gain * ( Variable - ZP ) + Xp
      kalmanFilteredPressure = (uint64_t)Xe;
      CalibratedKalman = kalmanFilteredPressure - initialDepthForKalman;
      BeforeKalman = (uint64_t)finalDepth - initialDepthForKalman;

      // NRF_LOG_INFO("Kalman : %d ", kalmanFilteredPressure);

      if (CalibratedKalman < 0) {
        AffichageBeforeKalman = 0;
      }
      if (BeforeKalman < 0) {
        AffichageAfterKalman = 0;
      }
      if (CalibratedKalman >= 0) {
        AffichageBeforeKalman = BeforeKalman;
      }
      if (BeforeKalman >= 0) {
        AffichageAfterKalman = CalibratedKalman;
        ;
      }

      if (Kalmancounter < 10) {
        Kalmancounter = Kalmancounter + 1;
        initialDepthForKalman = kalmanFilteredPressure;
      }

      timer = nrfx_rtc_counter_get(&rtc);
      timer = timer * 125;
      float hz1;
      hz1 = 1000000 / (float)timer;
      Watertonose = hakim.distance_to_nose - CalibratedKalman;

      NRF_LOG_INFO(" Water-Nose distance : %d cm |Nose : %d cm | Depth: %d cm | (Unfiltered : %d)| Position :%x | Time  %d ms ", Watertonose, hakim.distance_to_nose, CalibratedKalman, BeforeKalman, hakim.position.new_position, timer);
      NRF_LOG_FLUSH();

      nrfx_rtc_counter_clear(&rtc);
      //
      if (Watertonose < 0) {
        Underwatertimer = Underwatertimer + 100;
        Abovewatertimer = 0;
      }
      if (Watertonose > 0) {
        Abovewatertimer = Abovewatertimer + 100;
        if (Abovewatertimer > 700) {
          Underwatertimer = 0;
        }
      }
      if (Underwatertimer > globalTime*1000) {
        yellowledon();
        NRF_LOG_INFO("Danger !! stayed underwater more than Underwater Time.");
        NRF_LOG_FLUSH();
        DANGER = 0;
      }
      NRF_LOG_INFO("Under:%d | Above: %d | Maximum Time: %d ", Underwatertimer, Abovewatertimer, globalTime*1000);
      NRF_LOG_FLUSH();

      //initial min /max

      if (initialminmax == 0) {
        min = CalibratedKalman - Margin;
        max = CalibratedKalman + Margin;
        initialminmax = 1;
      }
      //up & down detection :
      if (CalibratedKalman > max) {
        changed = 1;
        goingdown = 1;
      }
      if (CalibratedKalman < min) {

        changed = 1;
        goingup = 1;
      }

      if (goingup == 1) {
        // NRF_LOG_INFO("UP");
        greenledon();
        //   redledoff();
      }
      if (goingdown == 1) {
        //NRF_LOG_INFO("Down");
        //  greenledoff();
        redledon();
      }
      if (stable == 1) {
        //NRF_LOG_INFO("unchanged");
        greenledoff();
        redledoff();
      }
      if (changed == 1) {
        min = CalibratedKalman - Margin;
        max = CalibratedKalman + Margin;
        stable = 0;
        changed = 0;
        changedtimer = 0;
        starttimer = 1;
      }
      if (starttimer == 1) {
        changedtimer = changedtimer + 100;
        if (changedtimer > 1000) {
          stable = 1;
          goingup = 0;
          goingdown = 0;
        }
      }
      if (stable == 0) {
        unstabletimer = unstabletimer + 100;
        if (unstabletimer == 20000) {
          DANGER = 1;
        }
      if (stable == 1){
    unstabletimer =0;
      }
      }

      NRF_LOG_INFO("changedtimer: %d , unstabletimer %d , Danger %d ",changedtimer,unstabletimer,DANGER);
      NRF_LOG_FLUSH();
      if (DANGER == 1){
      //Rescue();
      }
    }

  • Hi,

     

    If you are still seeing the same assert message, ie. PC=0x15a98, then the issue is related to the application preventing the softdevice to execute interrupts, thus the events occur at a later point and the softdevice detects and asserts due to this.

    Similar issue is described in this thread:  RE: S140 7.2.0 softdevice panic at 0x1786A 

    You should check your interrupt priorities and see if certain code in your application disables global interrupts at any point in time.

     

    Kind regards,

    Håkon

Related