Jump to content

p2baron

Members
  • Content Count

    31
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by p2baron

  1. I am currently working on a low power application. Using the MSP-EXP430FR5969 and the energytrace functionality in CSS I'm finally able to monitor the power usage of my sketch. (thanks for the writeup Frank!). I notice that if I call the following function my MSPG2553 is unable to suspend. // returns VCC in millivolts int getVCC() { // start with the 1.5V internal reference analogReference(INTERNAL1V5); int data = analogRead(ANALOG_HALFVCC_INPUT); // if overflow, VCC is > 3V, switch to the 2.5V reference if (data==0x3ff) { analogReference(INTERNAL2V5); data = (int)map(analogRead(ANALOG_HALFVCC_INPUT), 0, 1023, 0, 5000); } else { data = (int)map(data, 0, 1023, 0, 3000); } return data; } Can anybody tell me why this happens? The complete sketch is in the attachment. It is a wireless sensor that tells me when the mailman delivered the mail. mailboxsensor_v6-1.ino
  2. p2baron

    [SOLVED] Is this code blocking suspend()/lpm4?

    Marking this as solved. I have raised a new issue at github @@energia https://github.com/energia/Energia/issues/773
  3. p2baron

    [SOLVED] Is this code blocking suspend()/lpm4?

    I think I've found the culprit with the help of this article: http://www.elevendroids.com/2013/06/code-recipe-reading-msp430-power-supply-voltage-level/ If I add "ADC10CTL0 &= ~ENC;" to wiring_analog.c the problem is solved. i.e. #if defined(__MSP430_HAS_ADC10__) ADC10CTL0 &= ~ADC10ENC; // disable ADC ADC10CTL1 = ADC10SSEL_0 | ADC10DIV_4; // ADC10OSC as ADC10CLK (~5MHz) / 5 ADC10CTL0 = analog_reference | // set analog reference ADC10ON | ADC10SHT_3 | ADC10IE; // turn ADC ON; sample + hold @ 64
  4. p2baron

    [SOLVED] Is this code blocking suspend()/lpm4?

    It has something to do with the analogRead function. After I've sampled the internal ADC the average power consumption rises even though it goes into LPM4.
  5. p2baron

    [SOLVED] Is this code blocking suspend()/lpm4?

    @@Fmilburn wakeup is indeed needed @@spirilis I'm using Energytrace to measure power consumption I've tried setting the anologReference back to default. Unfortunately that doesn't help. attached are three screenshots. The first one is the EnergyTrace log without calling reportVcc() and the second one with. The third screenshot shows the debug screens from CCS Cloud. It is always calling the suspend() function. I'm a bit lost. Why is the MCU unable to suspend? Are there other thing I can check?
  6. p2baron

    [SOLVED] Is this code blocking suspend()/lpm4?

    Thanks for all the suggestions. I tried debugging the code in CCS cloud. Thanks for the tip. I did not even know that CCS Cloud existed! When debugging I see that the code is functioning fine and the the suspend() code is always called/entered. Two questions. Do I always need to clear an interrupt? Is the wakeup call even needed? Verstuurd vanaf mijn SM-G920F met Tapatalk
  7. p2baron

    [SOLVED] Is this code blocking suspend()/lpm4?

    1. Yes everything is working fine. Suspend is also working fine execpt once I've called reportVcc() it is unable to suspend again. 2. I don't have much experience with CCS. I'm also having troubles setting up CCS. After I've imported my Energia sketch and do a build I receive the following error: C:/Users/Pieter/Google Drive/03 - Workspace/CSS/lpmsp430g2553_core/Debug\liblpmsp430g2553_core.a(main.o): In function `main': C:/Users/Pieter/Google Drive/02 - Apps/energia-0101E0016/hardware/msp430/cores/msp430/main.cpp:7: undefined reference to `setup' C:/Users/Pieter/Google Drive/02 - Apps/energia-0101E0016/hardware/msp430/cores/msp430/main.cpp:10: undefined reference to `loop' collect2: ld returned 1 exit status gmake: *** [mailboxsensor_v6-1.out] Error 1 gmake: Target `all' not remade because of errors.
  8. p2baron

    Using EnergyTrace with Energia

    Just tried this. I received this error when I tried to start energytrace: A firmware update is required for the MSP430 Debug Interface You can solve this by downloading the MSP430 flasher from the TI website and running the command "MSP430Flasher.exe -s: i.e. C:\TI\MSP430Flasher_1.3.7>MSP430Flasher.exe -s
  9. p2baron

    Problems with CapTouch library

    Solved. See this thread: http://forum.43oh.com/topic/5465-problem-with-capacitive-touch-library/
  10. Guys, I am having some problems with the CapTouch library and need some help from the experts to resolve this. I modified (stripped) the CapTouch button example an uploaded that code to a G2553: #include <CapTouch.h> #define LEFT_BUTTON 10 #define MIDDLE_LED P1_6 uint8_t state = false; CapTouch left = CapTouch(LEFT_BUTTON, TOUCH_BUTTON); void setup() { /* Use the middle LED to indicate touch */ pinMode(MIDDLE_LED, OUTPUT); } void loop() { /* State will be 1 if any of the buttons was touched, otherwise 0 */ state = left.isTouched(); /* Turn on the LED if any of the buttons was touched */ digitalWrite(MIDDLE_LED, state); } This code runs fine for over 20 hours but then stalls. The the green led (as defined in the code) is constantly on and the board no longer responses. Any clues to what might cause this behaviour?
  11. p2baron

    Problem with Capacitive Touch Library

    @@zormino Thanks, that solved the problem for me!! @@energia Robert, sorry for the late reply. Here are my answers: 1: What are you using as the sensing pad? A piece of breadboard wire 2: What are you using as the power supply for the MSP430? Just a plain USB charger (LG, 5v, 800mA) 3: Is this a LaunchPad or is the MSP430 standalone (e.g. soldered onto a breadboard)? I used the launchpad Zormino's solution fixed the problem for me. I am unsure why I am having this problem but you don't.
  12. p2baron

    Problem with Capacitive Touch Library

    Robert is the Captouch-master. @@energia do you know a way to debug this?
  13. p2baron

    Building low power into Energia

    @@spirilis thanks. I will handle that in the main loop, I basically want to stay in LPM3/4 mode all of the time except when an interrupt occurs. Do I need to have sleepsecond(xxx) in the main loop?
  14. p2baron

    Building low power into Energia

    I am currently working on a low power mailbox sensor which notifies me when I recieve (snail) mail and when it is picked up. (I live in an appartment and my mailbox is in the central staircase) I've implement the changes from both Robert and Spirillis to enable low-power interrupts. This is the code: #include <x10rf.h> //https://github.com/p2baron/x10rf #define intpin1 P1_2 // Sensor on the outer lid <- used by mailman to deliver mail #define intpin2 P1_3 // Sensor on the inner lid <- used by me to pickup mail #define txpin P2_7 // Signal pin for 433Mhz module #define txvcc P2_6 // VCC oun for the 433Mhz module #define reps 4 // Number of times the RF message should be send. x10rf myx10 = x10rf(txpin,0,reps); void setup() { for(uint8_t i;i<20;i++) pinMode(i, INPUT_PULLDOWN); // Put all Pins in INPUT_PULLDOWN (see http://forum.43oh.com/topic/4984-low-power-mode-first-sketch/) myx10.begin(); pinMode(intpin1,INPUT_PULLUP); pinMode(intpin2,INPUT_PULLUP); pinMode(txvcc,OUTPUT); digitalWrite(intpin1, HIGH); digitalWrite(txvcc, LOW); attachInterrupt(intpin1, igotmail, CHANGE); attachInterrupt(intpin2, pickedupmail, CHANGE); } void loop() { sleepSeconds(200); } void igotmail() { uint8_t _state = digitalRead(intpin1); digitalWrite(txvcc, HIGH); if (_state == 0) { myx10.x10Security(3,0x04); // Send status alarm } sleep(10); digitalWrite(txvcc, LOW); sleepAbort(); } void pickedupmail() { uint8_t _state = digitalRead(intpin2); digitalWrite(txvcc, HIGH); if (_state == 0) { myx10.x10Security(3,0x84); // Send status normal } sleep(10); digitalWrite(txvcc, LOW); sleepAbort(); } My question is: Do I need to sleep in the main loop? And can I use "sleep" in the interrupt routines?
  15. p2baron

    Problem with Capacitive Touch Library

    I'm having similiar issue. Never managed to resolve this. I suspect this has something to do with the size of the object that is being used as the touchpad. Also the power supply seems to make a difference. With some cheap usb-charger the MCU constantly registered touches that weren't there.
  16. Please note that the precompiled Openwrt binaries contains ACM drivers that contain a bug. When your MSP430 spits out serial messages before you open the serial port (in python or bash) the driver crashes and no communication is possible. Wasted a couple of hours figuring that out. :-( This isn't a problem when the OpenWRT devices initiates communication. You can fix this by modifying the drivers and compiling OpenWRT yourself. Verstuurd vanaf mijn HTC One met Tapatalk
  17. p2baron

    Problems with CapTouch library

    THanks. I've done some testing this weekend. Please note that I am not using the CapTouch boosterpack. Just a wire and a piece of metal. This is the output I am getting when it goes berzerk: State: 1 Base: 18855 Measured: 10110 Delta: 8745State: 1 Base: 18855 Measured: 9983 Delta: 8872State: 1 Base: 18855 Measured: 10052 Delta: 8803
  18. p2baron

    Problems with CapTouch library

    @@energia , how did your test go? Not pushing for a solution but just curious if you've experienced the same behaviour. I will do a test tonight to see if this also affects the Stellaris boards.
  19. p2baron

    Problems with CapTouch library

    Hi Robert, just got home and noticed that the red light is on all of the time. The green light is still blinking so it seems to be something in the CapTouch library. Verstuurd vanaf mijn HTC One met Tapatalk
  20. p2baron

    Problems with CapTouch library

    Thanks. I will give it a go. I've replaced middle_led with red_led. I hope that isn't a problem.
  21. p2baron

    [Energia library] x10rf

    Not yet, it is still in breadboard phase. See my other post I am working on wireless door sensors with temperature and ambience reporting. Next to that I am planning to use this library to send my meter readings (power, gas) to my server. I will post pictures once something is finished.
  22. already posted this on the Stellaristi forum but this also works on MSP430 devices. Just change BLUE_LED to RED_LED in the examplle sketches. +-+- Hi All, Wanted to share a library I've created to broadcast x10 messages using a cheap 433Mhz OOK device. There are a lot of (Arduino based) libraries dealing with X10. I couldn't find any RF libraries that works without a 'firecracker' (CMA17) device so I've created one. I am not a coder and this is my first Energia library ever so use at your own risk. The library can emulate x10 switches and x10 security devices and also RFXMeter and RFXSensor devices manufactured by RFXCom. (www.rfxcom.com) Tested on a TI Stellarpad (LM4F120H5QR) and Energia 0101E0010. It should also work with other boards. Examples are provided with the library. You can find it on Github: https://github.com/p2baron/x10rf Regards, PP
  23. p2baron

    Check if I am in LPM4

    Thanks, I will try LPM3. Timing isn't critical since I need to send temperature (dallas 1-wire) and brightness (LDR?) every 30-60 minutes. I've used the latest Energia version so that should explain why my sketch is working. Not sure what this means for my code. It has been running for over a week on a coin cell battery. (cr2032)
  24. p2baron

    Check if I am in LPM4

    I am currently working on a battery operated wireless doorsensor. A message is sent whenever a magnetic switch causes an interrupt. I have read some topics on this forum and changed some lines in Winterrupts file and created the following sketch: #include <x10rf.h> #define intpin1 P1_5 #define txpin P1_7 #define txvcc P1_0 #define reps 4 x10rf myx10 = x10rf(txpin,0,reps); void setup() { myx10.begin(); pinMode(intpin1,INPUT_PULLUP); pinMode(txvcc,OUTPUT); digitalWrite(intpin1, HIGH); digitalWrite(txvcc, LOW); attachInterrupt(intpin1, Wake, CHANGE); } void loop() { LPM4; } void Wake() { int state = digitalRead(intpin1); digitalWrite(txvcc, HIGH); switch(state) { case 0: myx10.x10Security(3,0x84); break; case 1: myx10.x10Security(3,0x04); break; } delay(10); digitalWrite(txvcc, LOW); } This is working great but I have some questions. How can I check that MCU is running in LPM4? Do I need CCS to check (debug) this or are there other ways? At some point I want to add sensors to periodically report temperature and light conditions. What is a power efficient way to do this? I know timers don't work in LPM4. Should I switch to LPM3 or use an external circuit to wake the MCU every x minutes?
  25. p2baron

    [SOLVED] Using CapTouch lib from a class

    For the transmission side I use a 433Mhz OOK FSK transmitter: The receiving end is a wireless dimmer sold by http://www.klikaanklikuit.nl. I believe this is sold as "HomeEasy" in other parts of the world. I am still having problems with the code. The MCU freezes(red and green led on) after some time. Is it possible that my sketch is causing a RAM-overflow after some time? Not sure how to debug this
×