Jump to content


  • Content Count

  • Joined

  • Last visited

About clay_shooter

  • Rank

Profile Information

  • Gender
    Not Telling
  • Location
    Near DC
  • Sparkfun
  1. I worked (hacked) on the MSP430 TwoMSecTimer library until it became the AnyMSecTimer library that can be used on MSP430 or on the Stellaris / Tiva. It uses one of the timers when running on an MSP430 and a Systick handler on the bigger boards. Register your function from your ino file with the timer along with an interval in msec. The registered function will be invoked at that interval. A sample app is on github. https://github.com/freemansoft/build-monitor-devices/tree/master/ti_launchpad_rgb_2 -- setup -- AnyMsTimer::set(STATE_STEP_INTERVAL, my_function); AnyMsTimer::start(); -- function signature -- void my_function(){ // remember to do as little as possible here because interrupts are masked off } http://joe.blog.freemansoft.com/2015/02/energia-code-on-timer-with-tiva.html
  2. Thanks for the help. That was easy. My MSP430 timer callback now works on the stellaris.
  3. Thanks for the reply. I wasn't sure if it was 1ms or 1us. There are other posts floating around about delaymillis() vs delaymicros() and how they are implemented. I'm still not sure how micros are calculated if they aren't using SystTick, some other timer (5?) perhaps. So in theory, I should be able to register a handler with registerSysTickCb() and get a callback every 1ms?
  4. I'd like to run interrupt handlers on timer functions. With the MSP430 I had to write a library for it. It looks like I should be able to use SystTicks functions like registerSysTickCb(). How often would I get called? 80Mhz/???
  5. I really like the low profile "no wires" aspect of this boosterpack. I have a couple of DX Extreme and Sparfun breakout boards sitting on the shelf. Do you think it would be possible to solder those boards to the top of this one to use yours as a pass-through to the MSP430? I guess I could remove the LCDs from the DX Extreme boards and move them to yours if the pass-through won't work. Thanks!
  6. I used the code on this page http://mspsci.blogspot.com/2010_06_01_archive.html It sets up the timer that can be driven from the crystal. It requires CCS but you should get the general idea.
  7. You're not going to want to pause/delay inside an interrupt handler. They really need to process and exit as quickly as possible to re-enable other interrupts. For button debounce (I/O interrupt), you could accept the button and do the work on the first interrupt and then record millis() in a variable. Then any interrupt after that checks the recorded millis() to see if enough time has passed for this interrupt to be a new button press. Otherwise you would ignore the state if enough time hasn't passed. You can do the same thing if you are polling the button in a timer interrupt. You could set a flag in the interrupt handler and then have the main loop process after some time has passed possibly even using a delay() in the main loop. Others probably have better ideas but you really want your interrupt handlers to be as tight and quick as possible so that other work can be done. Delays in interrupts can freeze out the watchdog timers causing some systems to restart.
  8. I've ported a version of MsTimer2 to the Energia / MSP430 environment. Its called TwoMsTimer and it provides a way to get a method called on regular intervals, as fast as once very two msec. You just create a TwoMsTimer object passing in the (void) method that you want called and TwoMsTimer will take care of the rest. The timer relies on Timer 1 in a way that is compatible with PWM letting you use the Timer 1 PWM pins and get timed function invocation. It is named TwoMsTimer because the PWM CCR0 interrupt rate is about 500Hz giving us 2 msec resolution. You can find the sample code and a demo showing how it works on http://joe.blog.freemansoft.com/2012/09/msp430-fading-and-other-long-running.html The code is really simple with no "if define" behavior for different processors. I've only tested it on the Launchpad with the 2553 processor.
  9. The problem is in the way path names get truncated and referenced. A directory with c:\dev\energia-0101E0006 and c:\dev\energia-0101E0008 has alternative names c:\dev\Energi~1 and c:\dev\Energi~2 (I think the second one is ~2). They are assigned the shortened names in the order they were created in the parent folder, c:\dev in this case. When I compile with 0101E0008 it actually runs the following which actually runs the code in 0101E0006. C:\DEV\ENERGI~1\HARDWARE\TOOLS\MSP430\BIN\msp430-g++ -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=msp430g2553 -DF_CPU=16000000L -DARDUINO=101 -DENERGIA=8 -IC:\dev\energia-0101E0008\hardware\msp430\cores\msp430 -IC:\dev\energia-0101E0008\hardware\msp430\variants\launchpad C:\Users\joe\AppData\Local\Temp\build3212920642439510589.tmp\CheapIndicatorLight.cpp -o C:\Users\joe\AppData\Local\Temp\build3212920642439510589.tmp\CheapIndicatorLight.cpp.o When I delete 0101E0006, there is no directory aliased to ENERGI~1. I fixed it by moving both versions to the trash can and then restoring 0101E0008. That made it be ENERGI~1 and both compilation and HTML copy work fine.
  10. I have weird problems with 0101E0008. It is installed in c:\dev\0101E0008 and 0101E0006 installed in c:\dev\0101E0006. version 0101E0008 works great until I delete 0101E0006. Then 0101E0008 can't find the compiler. It starts working fine if I restore version 0101E0006 to its previous location. Also copy HTML doesn't work in 0101E0008 but does work for 0101E0006.
  11. Has anyone ported MsTimer2 to the MSP430? The MSTimer2 Arduino library provides a simple interrupt driven mechanism for getting timed function invocation. I've used it to control fader and polling intervals without having to sit in delay() loops. It looks like TimerSerial and Servo make use of intterupt vectors. TimerSerial uses both Timer0_A0 and Timer0_A1 while servo uses Timer0_A0. It seems like an MSTimer2 port could use Timer0_A1 so that both servos and the timer could be used at the same time. I have a couple questions. Does TimerSerial or Servo usage mess with the PWM pins tied to that same timer? And by extension would MsTimer2 mess with pwm pins? If PWM is still available, does that 500Hz PWM rate imply an interrupt vector calling rate of 1/2ms? T0A2 (T A0 CCR2) isn't used on 20 pin devices. Can this timer/interrupt/CCR be used to generate interrupts while leaving the PWM timers/CCR alone? This question may show some ignorance around how the CCR/Timers inter-operate. The TI docs refer to the vectors as Timer0_A3 and Timer1_A3. Should there a comment in the docs that mention those are the same as energia defined Timer0_A0 and Timer1_A1? Note: Using the watchdog for Delay() and Millis() is a slick idea.
  • Create New...