4 Replies Latest reply on Jan 27, 2017 7:01 AM by e.pratt_1639216

    Debugging versus Programming with MiniProg3

    e.pratt_1639216

      I'm having a strange issue with my CYBLE-022001-00 board that I'm trying to develop. When I run my application in debug-mode everything seems fine and works as I want it to, but when I switch and program the chip to run without debugging, then the chip no longer transmits/works as it did in the debugging mode.

         

       

         

      Are there configuration or hardware settings that are different between the programming/free-running and debugging uses of the MiniProg3?

         

      I've left SWDIO set to DEBUG, but that shouldn't affect the free-running program...

         

      The only thing I can think of is that I'm using CySysPmSleep(), CySysPmDeepSleep(), or CySysPmHibernate() wrong, but then I would expect the debugging mode to fail as well.

         

      Any thoughts on this would be appreciated. I've been having issues with the code behaving differently based on the debug/program uses of the MiniProg3 for about two weeks now, and I can't seem to figure out what is going on.

        • 1. Re: Debugging versus Programming with MiniProg3
          user_242978793

          Sleep doesn't  work the same in debug as it does in real time.  Please post you code so we can check it.

          • 2. Re: Debugging versus Programming with MiniProg3
            e.pratt_1639216

            Sorry about the messy code, I've been trying to get proof-of-concept working and hav'nt bothered to clean up the architecture/code much.

               

            I figured it might be something with the power modes, but I can't see how.

            • 3. Re: Debugging versus Programming with MiniProg3
              user_242978793

              What voltage is your battery?  The settings for your ADC are set for  0 to 1.024 Volts that is very low for a battery for this Chip. Also your pin selection is not correct for the ADC input.  I moved it to P3(4) from P5(0). I haven't  tried it on my board yet.  It doesn't like this line in your BleStack.c  uint8 buttons = ButtonStatus(); Says trying to make a integer from a pointer without a cast.

              • 4. Re: Debugging versus Programming with MiniProg3
                e.pratt_1639216

                The battery is a lithium coin cell, so it will run between 2.8 and 3.3 volts. I have an external resistor-divider network attached between pins 5.0 and 5.1 from the battery voltage. I've been using it to measure the battery voltage of the coin cell with reference to the internal 1.024v, as reading the ADC value of the Vdd itself will always give maximum "count" until the battery dies as the voltage reference will vary itself with the reading. I'm using the ADC on P5.0 and pulling pin5.1 low while I read the voltage of the battery with reference to the internal 1.024v and then putting it back to high/analog-impedance once I am done reading to remove as much leakage current as possible.

                   

                You can just comment out the uint8 buttons = ButtonStatus(); line, as it is currently unreachable in the code. I have it set up to use a different BLE callback function based on which mode the unit is in in order to simplify the code flow and logic, but since I can't get the power-saving operations working I disabled the "Normal_BLE" and "Bonding_BLE" callbacks and set it to permanently use the "Broadcast_BLE" callback.

                   

                At using p5.0 for the adc, reading the popup it says only that it might cause routing congestion/failure if I use that pin for the ADC, but it seems to work fine when testing the hardware and based on the compiler/IDE output when building and programming it.