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.

MSP430F1611 fast enough for 1kHz PID controller

Other Parts Discussed in Thread: MSP430F1611

I want to use the MSP430F1611 for a closed loop PID controller that has to operate at around 1 kHz. The input will be 4 analog signals that need to be sampled each control loop. There will be one output through an SPI connection.

With the processor running at 8 MHz this will give me 8000 cycles for each control loop. The ADC12 should take ~0.02ms for all 4 values plus the interrupt overhead. (Assuming the ADC12 can reach the 200ksps rate in this case) Regarding my SPI output I only need to send 12 bytes each control loop (no receive). With an SPI clock of 4 MHz (main clock divided by 2) this should take around 0.024ms plus 12 times the time it takes to refill the 8 bit shift register with a new value through the DMA.

The calculations necessary to get my output values from the input are fairly straight forward so I think this won’t cost many cycles. However I’m not quite sure how to estimate the overhead that is generated by interrupt routines and DMA transfers. Disregarding this extra time the ADC and SPI should only take up ~5% of the 1ms I have each loop.

I don’t have a lot of experience estimating performance requirements so I would greatly appreciate any help. In case you are wondering: Other higher performant versions of the MSP430 are not an option because I want/have to use this specific version of the MSP430. My main concern is the overhead generated by the ISR and the DMA transfers. If you have done something similar that could give me a better understanding of how to estimate my performance requirement that would also be greatly appreciated.

Thanks in advance for all helpful replies!

  • Right away you can forget about floating point PID controller. Consider discrete (fixed point) math only. For new designs I would not use old and expensive 1x series chip, especially taking in account it's max clock frequency. Check FR5x/F5x/F6x chips

    >If you have done something similar that could give me a better understanding of how to estimate my performance requirement that would also be greatly appreciated.

    I usually don't estimate but just quickly prototype and measure. Tweak generic fixed point PID controller for 4 inputs and run following test:

    main()
    {
    
     while (1) {
       xor_led();
       pid_controller();
     }
    
    }

    Measure LED frequency and you will know your PID routine timing without complex (meaningless) estimations.

  • The interrupt overhead (raising and returning) is 11 MCLK cycles. The actual code in the interrupt handler is executed normally.
    (If the CPU is in a sleep mode, waking up might take some time.)

    A DMA transfer needs 2 MCLK cycles.

  • >I don’t have a lot of experience estimating performance requirements so I would greatly appreciate any help.

    As a professional engineer (i.e. not hobbyist), I admire the desire you show to do true engineering analysis of requirements and resources rather than just "winging it". Designing and building boards, and developing software, cost real money in the corporate world and this type of analytic work is important to an efficient engineering environment.

    I think Clemens gave you the information that you need to move forward.
  • Brian Boorman said:
    I think Clemens gave you the information that you need to move forward.

    Right.

**Attention** This is a public forum