This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-MSPM0L1306: Timer event trigger ADC start sample only works once

Part Number: LP-MSPM0L1306
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi

I was looking into setting up events for starting an ADC by a timer event and I found an example code "adc12_triggered_by_timer_event".
The code work fine on the first ADC measurement and after it goes into default handler, which seems to be caused by hard_fault_handler.

The changes i did to the code is shown below


  • Hi,

    Your question has been received, and we are currently debugging and reproducing your problem.

    We will reply you as soon as possible.

    B.R

    Peter

  • Hi,

    Regarding your question, firstly, if you enter sysconfig tools, you can find out that the Timer is set to "One-shot Down Counting mode", and ADC conversion does not enable Repeat Mode. Therefore, the "adc12_triggered_by_timer_event" demo will only generate one Timer event to trigger ADC to complete one sampling, then the code will execute and stop at the software breakpoint "__BKPT(0)".

    In addition, if you want to achieve a Timer loop to generate events to trigger ADC multiple conversions, you can set the "Timer Mode" to "Periodic Down Counting", and "Enable Repeat Mode" in ADC configuration in sysconfig, then refer to the following code for simple modification and testing.

    B.R.

    Peter

  • so the BKPT(0) is a breakpoint but also a function to stop the program from running even though I set it to run again?

  • Hi, 

    Regarding BKPT's functions, to be precise, here is the official description from ARM,  "The BKPT instruction causes the processor to enter Debug state. Debug tools can use this to investigate system state when the instruction at a particular address is reached." and also,  "The processor might also produce a HardFault or go into Lockup if a debugger is not attached when a BKPT instruction is executed" 

    you can go to ARM website for more details. https://developer.arm.com/documentation/dui0662/b/The-Cortex-M0--Instruction-Set/Miscellaneous-instructions/BKPT

    B.R.

    Peter