Jump to content

Markers

Members
  • Content Count

    30
  • Joined

  • Last visited

  • Days Won

    1

Markers last won the day on June 10 2018

Markers had the most liked content!

About Markers

  • Rank
    Advanced Member

Profile Information

  • Location
    Sydney Australia
  • Interests
    Learning to design and program embedded hardware

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I have built an embedded product on a custom pcb that uses an MSP430G2553 communicating with a MMA8451 accellerometer via I2C, and flashing LEDs when certain acceleration events cause interrupts. The system works reasonably well but I want to add some post-interrupt code to verify the direction and intensity of the acceleration to avoid false positives. I can read the value in the relevant TRANSIENT_SRC register (0x1E) on the MMA8451 but the system hangs returning from the ISR. I placed a breakpoint in the closing curly bracket of the ISR, and when I stepped past this breakpoint an Assembler routine called "isr_trap.asm" opens and hangs on line "BIS.W #(0x0010),SR". I see from previous posts that this is a trap for "an interrupt [that] occurs that has no ISR assigned." My register read routine is: char Receive(char registerAddr) { char receivedByte; while (UCB0CTL1 & UCTXSTP); // Ensure stop condition got sent UCB0CTL1 |= UCTR + UCTXSTT; // I2C start condition with UCTR flag for transmit while((IFG2 & UCB0TXIFG) == 0); //UCB0TXIFG is set immediately UCB0TXBUF = registerAddr; //write registerAddr in TX buffer while((IFG2 & UCB0TXIFG) == 0); // wait until TX buffer is empty and transmitted UCB0CTL1 &= ~UCTR ; // Clear I2C TX flag for receive UCB0CTL1 |= UCTXSTT; //+ UCTXNACK; // I2C start condition with NACK for single byte reading while (UCB0CTL1 & UCTXSTT); // Start condition sent? RXBuffer full? UCB0CTL1 |= UCTXSTP; // I2C stop condition //while(UCB0RXIFG != (IFG2 & UCB0RXIFG)); //keep checking for recv ready flag while((IFG2 & UCB0RXIFG) == 0); // wait until TX buffer is empty and transmitted receivedByte = UCB0RXBUF; return receivedByte; } Can anyone see a issue that is likely to cause my problem? Note that the system works perfectly is I do not read TRANSIENT_SRC. Many thanks, Mark.
  2. Hi Jcjc, If your follow the response stream above you will see that I had to rename my User file to remove a space I had in my name. It was a bit of a pain but eventually it worked. Regards, Mark
  3. Hi Zeke, Yes, that is exactly what I have done, and the end result is exactly what I needed. Thanks again for your help. Cheers, Mark
  4. Hi again Zeke, I have found either a workaround or the correct solution (not sure which!): I addded "_bic_SR_register_on_exit(LPM3_bits);" to the end of both ISRs which I have never had to do before, but it is all working perfectly now. I'm very grateful for your help. Regards, Mark
  5. Hi Zeke, I have implemented your suggestions for Fired and Serviced flags outside of the ISRs but now the program will not fall into the while(1); loop at all after an interrupt. I know the program loops through the ISRs at the appropriate times but nothing else happens. Do you have any idea why this is happening? Thanks, Mark
  6. Hi Zeke, Many thanks for your prompt response. Yes, indeed it does help! I was concerned about all the activity in the ISRs but wasn't sure how to extract it. The printfs will certainly be removed once the prototype is stable, and I will tune the ACLK so that I get a consistent 1 minute loop. Finally, I have found the cause of the occasional error in the Timer ISR: if the process freezes for more that 1 minute (1 cycle) another Timer interrupt is created causing the program to run through the ISR and increment ++TThis. I will disable this spurious interrupt which should fix my remaining problem. Many thank, Zeke! I think this thread may be closed. Regards, Mark
  7. Hi all. I have made a lot of progress on my project, and have only one issue eluding me at this stage of the prototyping It involves getting a timer interrupt and a button interrupt to work together. I have 3 key times T1, T2 and T3 that determine the actions: between time 0 and T1 nothing happens; between T1 and T2 the timer re-sets to zero and starts again; between T2 and T3, P1.6 flashes 10 times; and after T3 the timer must freeze where it is until a button interrupt re-sets the timer to zero and starts again. The code is attached. You will see I have implemented tiny_printf so I can watch TAR and my 1-minute (approx.) counter TThis. All these printf statements obviously take up time so the 1-minute counter is not very accurate but this is not pivotal at this stage. My problem is that I have tried everything I can think of to stop the timer after T3 is exceeded but more often than not I am getting a spurious timer interrupt after the button interrupt after T3, effectively losing a minute in the process. Note: this does not happen every time so it is hard for me to find and fix. Any help will be greatly appreciated Thanks, Mark. main.c
  8. Hi NurseBob. Thanks for your latest messages. The reference on low power design is great and will certainly help. You are correct in your assessment that l am "just getting into electronics" : I am 70 and a recently retired engineer and loving getting into hardware after decades of (self-taught) programming. Hence the sometimes naive questions! I have been using Dave Jones' blog which is very informative. Thanks again.
  9. Hi All, I think I have discovered something, but I'm not sure what! I noticed when I turned my LED desk lamp off the consumption rose, and fell again to it's ~12uA level when I turned it back on. Also, the LaunchPad was on my desk quite close to my laptop. I then dangled the LaunchPad over the edge of the desk on the USB cable (ie. in the shadow of the lamp, and below the level of the laptop), and the power consumption went down to a steady 0.6uA as in the Workshop video! The power consumption still shoots up if I move my hand close to the LaunchPad... Thanks for all your help, Mark
  10. Hi Frida, Thanks - those are good thoughts. The Lab example has the following code which I assumed handles the inputs and outputs: void ConfigPins(void) { P1DIR = ~BIT3; // P1.3 input, others output P1OUT = 0; // clear output pins P2SEL = ~(BIT6 + BIT7); // P2.6 and 7 GPIO P2DIR |= BIT6 + BIT7; // P2.6 and 7 outputs P2OUT = 0; // clear output pins } Would that code not be sufficient to prevent noise from any un-terminated input pins? Thanks, Mark
  11. Hi Rei and NurseBob, Thanks for your responses. Rei, yes the green LED jumper is on, and no, the green LED pin is not shared - as per the Workshop video, the LaunchPad is stand-alone, only connected via the USB cable to the computer. NurseBob, I have tested the project in Release mode and the power consumption drops to about 10-17uA, but the reading fluctuates a fair amount. Interestingly, if I hover my hand over the top of the LaunchPad the power consumption goes up to 60-80uA but again very variable!? The vidoeo in the Workshop does not show such fluctuations, and I can't understand why mine is so unsteady. I have also powered the LaunchPad using a 3V battery through the DMM but this gives me a nonsense reading of about 12mA (stable though). I'm thinking it must be my DMM unless you can think of any other reason. I am concerned, though, that my final project may not operate for years on a battery as the calculations suggest if the power consumption is in the 20uA range instead of ~1uA. Thanks again, Mark
  12. Hi, I have been working through the MSP430G2553 Workshop and have just finished Lab 6. Running the code from Lab6c.txt in the supporting files does not give me quite the same results as in the video: the green LED does not come on, and the current draw on my Digitor Q1585 DMM shows about 20uA, not the 0.6uA I was expecting. Does anyone know whether my LaunchPads may be faulty (I have tried the example on 2 with the same results) or whether my DMM does not have a sufficiently low effective resistance? I am reluctant to continue with the Workshop until I am sure I will be able to achieve the maximum power savings for my project. My LaunchPad is ver 1.5 with the MSP430G2553 MUC as in the video. Many thanks, Mark
  13. Hi All, Many thanks for all your responses. NurseBob, you were right on the money: Energia was not installed. I re-installed it and everything is now working as it should. Many thanks! Mark
  14. Hi, I was working on an imported Energia project in CCS when I was informed that a software update to CCS was available. I installed the upgrade and restarted CCS in my project which now will not build. Instead I get the message "Buildfile generation error occurred.. Product 'energia.core' v18.0 is not currently installed and no compatible version is available. Please install this product or a compatible version. Build stopped.." My version of Energia is the latest (18). Can anyone help please! Thanks, Mark
  15. Thanks Rei. Wish I had known before I wasted money on three 2553s.
×
×
  • Create New...