Jump to content

brainwash

Members
  • Content Count

    32
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. Like
    brainwash got a reaction from xpg in Eclipse plugin for mspdebug and msp430-gcc   
    I don't know how relevant this is but TI has brought mspgcc support to their IDE: http://www.ti.com/tool/msp430-3p-gcc-mspgcc-tpde
    While it's still not a clean Eclipse installation it allows usage of GCC code and probably easy Energia integration.
    Also: http://e2e.ti.com/blogs_/b/msp430blog/archive/2013/12/09/you-beta-believe-it-gcc-and-ccsv6.aspx
     
    If an IDE is what you are looking for, GCC is now integrated in the recent BETA release of Code Composer Studio 6 as well. This means that if the size and speed and optimization support offered by the TI compiler are unnecessary for your application, you can choose to compile with GCC and use Code Composer Studio for free, without any code size limitation!
     
  2. Like
    brainwash got a reaction from mikikg in AD9850 with Energia   
    Very simple code to get the AD9850 [ebay] module up and running. I will use Energia whenever possible because it results in more portable code.
     
    /* Using the AD9850 DDS ebay module with Stellaris Launchpad. Code based on http://nr8o.dhlpilotcentral.com/?p=83 and https://gist.github.com/raivisr/3861473 PA2 - W_CLK PA3 - FQ_UD PA4 - DATA PB6 - RESET VCC - VCC (5V can also be used but will dissipate more heat) GND - GND Serial comms - 9600, NewLine (0x0A) denotes end of input, f 10000 - set frequency s 20 20000 10 1000 - sweep from frequency to frequency using this step size in that many milliseconds o 10 10000 5 3000 - oscillating sweep from frequency to frequency and back using this step size in that many ms */ #define MAXBUF 40 #define W_CLK PA_2 // Pin 8 - connect to AD9850 module word load clock pin (CLK) #define FQ_UD PA_3 // Pin 9 - connect to freq update pin (FQ) #define DATA PA_4 // Pin 10 - connect to serial data load pin (DATA) #define RESET PB_6 // Pin 11 - connect to reset pin (RST). #define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); } // transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line void tfr_byte(byte data) { for (int i=0; i<8; i++, data>>=1) { digitalWrite(DATA, data & 0x01); pulseHigh(W_CLK); //after each bit sent, CLK is pulsed high } } // frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32 void sendFrequency(double frequency) { int32_t freq = frequency * 4294967295/125000000; // note 125 MHz clock on 9850 for (int b=0; b<4; b++, freq>>=8) { tfr_byte(freq & 0xFF); } tfr_byte(0x000); // Final control byte, all 0 for 9850 chip pulseHigh(FQ_UD); // Done! Should see output } double freqValue = 0; double freqStart = 0; double freqEnd = 0; double freqStep = 0; int sweepDelay = 0; char freqStr[MAXBUF]; int bufPos = 0; char byteIn = 0; int mode = 0; void setup() { // configure arduino data pins for output pinMode(FQ_UD, OUTPUT); pinMode(W_CLK, OUTPUT); pinMode(DATA, OUTPUT); pinMode(RESET, OUTPUT); pulseHigh(RESET); pulseHigh(W_CLK); pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10 Serial.begin(9600); memset(freqStr,0,sizeof(freqStr)); sendFrequency(1e7); } void loop() { if (mode == 1 || mode == 2) { delay(sweepDelay); if (((freqStep > 0.0) && (freqValue + freqStep <= max(freqStart,freqEnd))) || ((freqStep < 0.0) && (freqValue + freqStep >= min(freqStart,freqEnd)))) freqValue += freqStep; else if (mode == 1) freqValue = freqStart; else { freqStep *= -1; freqValue += freqStep; } sendFrequency(freqValue); } while (Serial.available()) { byteIn = Serial.read(); if (bufPos < sizeof(freqStr)) freqStr[bufPos++] = byteIn; else { bufPos = 0; byteIn = 0; memset(freqStr,0,sizeof(freqStr)); Serial.println("Command too long. Ignored."); } } if (byteIn == 0x0a) { switch (freqStr[0]) { case 'f': mode = 0; freqValue = strtod(freqStr+2,NULL); freqEnd = 0; freqStep = 0; sweepDelay = 0; Serial.print("Frequency "); Serial.println(freqValue); break; case 's': case 'o': char *fEnd1, *fEnd2; freqStart = abs(strtod(freqStr+2,&fEnd1)); freqEnd = abs(strtod(fEnd1,&fEnd2)); freqStep = abs(strtod(fEnd2,&fEnd1)); if (freqStep == 0) { Serial.println("You gotta be kidding me, step can not be 0"); break; } sweepDelay = abs(atoi(fEnd1)); if (freqStr[0] == 's') { mode = 1; Serial.print("Sweep"); } else { mode = 2; Serial.print("Oscillate sweep"); } Serial.print(" start freq. "); Serial.print(freqStart); Serial.print(" end freq. "); Serial.print(freqEnd); Serial.print(" step "); Serial.print(freqStep); Serial.print(" time "); Serial.println(sweepDelay); sweepDelay /= abs(freqEnd - freqStart) / freqStep; if (mode == 2) sweepDelay /= 2; if (freqStart > freqEnd) freqStep *= -1; freqValue = freqStart; break; default: Serial.println("AI blown up - unknown command. Available commands:"); Serial.println(" f 10000 - set frequency"); Serial.println(" s 20 20000 10 1000 - sweep from frequency to frequency using this step size in that many milliseconds"); Serial.println(" o 10 10000 5 3000 - oscillating sweep from frequency to frequency and back using this step size in that many ms"); Serial.println(" frequency can be given in floating point format: 1.23456e7"); } memset(freqStr,0,sizeof(freqStr)); byteIn = 0; bufPos = 0; sendFrequency(freqValue); } }  
     
  3. Like
    brainwash reacted to grahamf72 in Sleep mode during a fixed duration ?   
    The standard Energia delay() function spends most of its time in LPM0.  If you want lower than that you need to set up a timer running off either the optional Crystal or the VLO clock. 
     
    As an example for long low power delays, you could do something like the following:
     
    #include <Energia.h> volatile unsigned long delaycounter; void StartTimer() { //To use the VLO, Use the following: BCSCTL1 &= ~DIVA_3; // ACLK without divider - nominally 12kHz BCSCTL3 = (LFXT1S_2); // Source ACLK from VLO TA1CCTL0 = CCIE; // CCR0 interupt activated TA1CCR0=11999; // 12000 ticks is nominally 1 second TA1CTL = TASSEL_1 | ID_0 | MC_1; // Clock for TIMER = ACLK, No division, up mode //Alternatively to use the Crystal for more accuracy use the Following /* P2SEL |= (BIT6 | BIT7); // Reset P2_6 & P2_7 BCSCTL1 &= ~DIVA_3; // ACLK without divider - 32768kHz BCSCTL3 = (LFXT1S_0 | XCAP_3);// Source ACLK from XTal TA1CCTL0 = CCIE; // CCR0 interupt activated TA1CCR0=4096-1; // we are dividing clock by 8, so 4096 ticks = 1 second TA1CTL = TASSEL_1 | ID_3 | MC_1; // Clock for TIMER = ACLK, By 8 division, up mode */ } void StopTimer() { TA1CTL|=TACLR; } //Set Up the Interrupt routine... __attribute__((interrupt(TIMER1_A0_VECTOR))) void timer_isr (void) { ++delaycounter; //increment our seconds counter __bic_status_register_on_exit(LPM3_bits); //exit at full power. } //And here is our delay function... //this will create delays of up to approx 136 years //with 1 second resolution. void longdelay(unsigned long delayseconds) { delaycounter=0; StartTimer(); //start our timer up while (delaycounter<delayseconds) //while we haven't reached our count... __bis_status_register(LPM3_bits+GIE); //switch back to LPM3. StopTimer(); //times up, stop our timers. }; void setup() { Serial.begin(9600); }; void loop() { Serial.println("10 seconds mostly in LPM0 with traditional delay..."); delay(10000); Serial.println("10 seconds in LPM3 with longdelay..."); longdelay(10); };  
    When I tested this, I was getting about 1300uA (1.3mA) during the traditional delay(). This dropped to about 25uA when it was in the longdelay function.
  4. Like
    brainwash reacted to L.R.A in Veroboard for msp430 in my club   
    First i would like to clarify why i'm making this board
     
    I'm in a robotics club. It only uses microcontrolers modules designed for basic. I wanted to change that.
    I realy like Texas microcontrolers for the price and it was more easy for me to use the hardware than with arduino.
    With Energia it is easy to program the basics and still learn C++ wich is a better preparation for future of the students involved.
     
    First of all thanks for making Energia. It let me create alot of small projects wich i couldn't with arduino (problems with programing external chips). It also lets me learn C assembly little by little since MSP430 is originaly programed in that but still use C++ when i just don't know.
     
    I'm creating like a manual for the new ones that join know how to work with C++ in Energia and basics for electronics, all in my native language. Also translating all examples to portuguese
    In all that i'm also designing a Veroboard for msp430 because the launchpad is a little limited for some robots. The board includes I2C converter with mosfets, a led RGB and 1 push button. It has also lots of pins to supply current to sensors and motors with 5V, 3.3V or direct from 2 diferent power supplies.
    It's in veroboard because it's the only ones it can made in the club.
    I wanted to share to anyone who wants it since it doesn't need any PCB. Any sugestions are welcome

  5. Like
    brainwash got a reaction from bluehash in Simple scope readout on 5110 display   
    I'm in the process of building a dual lab power supply with and the Stellaris should provide monitoring and protection shutdown.
    I've ported the Adafruit LCD library to Energia LM4F (it should be easy to port to MSP430 as well) so I'm using that to display stuff in graphical format.
     
    The code below does a few tricks that might be useful for some of you: a rolling buffer to hold the data, automatic vertical scaling between the minimum and maximum values.
    As always, any kind of feedback is appreciated, I'm still a beginner.
     
    A picture is worth a thousand words. I only have 5 points of resolution in this picture but the vertical scale is actually 20 points.

     
  6. Like
    brainwash got a reaction from roadrunner84 in Simple scope readout on 5110 display   
    I'm in the process of building a dual lab power supply with and the Stellaris should provide monitoring and protection shutdown.
    I've ported the Adafruit LCD library to Energia LM4F (it should be easy to port to MSP430 as well) so I'm using that to display stuff in graphical format.
     
    The code below does a few tricks that might be useful for some of you: a rolling buffer to hold the data, automatic vertical scaling between the minimum and maximum values.
    As always, any kind of feedback is appreciated, I'm still a beginner.
     
    A picture is worth a thousand words. I only have 5 points of resolution in this picture but the vertical scale is actually 20 points.

     
  7. Like
    brainwash got a reaction from chibiace in Simple scope readout on 5110 display   
    I'm in the process of building a dual lab power supply with and the Stellaris should provide monitoring and protection shutdown.
    I've ported the Adafruit LCD library to Energia LM4F (it should be easy to port to MSP430 as well) so I'm using that to display stuff in graphical format.
     
    The code below does a few tricks that might be useful for some of you: a rolling buffer to hold the data, automatic vertical scaling between the minimum and maximum values.
    As always, any kind of feedback is appreciated, I'm still a beginner.
     
    A picture is worth a thousand words. I only have 5 points of resolution in this picture but the vertical scale is actually 20 points.

     
  8. Like
    brainwash got a reaction from energia in Simple scope readout on 5110 display   
    I'm in the process of building a dual lab power supply with and the Stellaris should provide monitoring and protection shutdown.
    I've ported the Adafruit LCD library to Energia LM4F (it should be easy to port to MSP430 as well) so I'm using that to display stuff in graphical format.
     
    The code below does a few tricks that might be useful for some of you: a rolling buffer to hold the data, automatic vertical scaling between the minimum and maximum values.
    As always, any kind of feedback is appreciated, I'm still a beginner.
     
    A picture is worth a thousand words. I only have 5 points of resolution in this picture but the vertical scale is actually 20 points.

     
  9. Like
    brainwash got a reaction from RobG in Simple scope readout on 5110 display   
    I'm in the process of building a dual lab power supply with and the Stellaris should provide monitoring and protection shutdown.
    I've ported the Adafruit LCD library to Energia LM4F (it should be easy to port to MSP430 as well) so I'm using that to display stuff in graphical format.
     
    The code below does a few tricks that might be useful for some of you: a rolling buffer to hold the data, automatic vertical scaling between the minimum and maximum values.
    As always, any kind of feedback is appreciated, I'm still a beginner.
     
    A picture is worth a thousand words. I only have 5 points of resolution in this picture but the vertical scale is actually 20 points.

     
  10. Like
    brainwash got a reaction from spirilis in Simple scope readout on 5110 display   
    I'm in the process of building a dual lab power supply with and the Stellaris should provide monitoring and protection shutdown.
    I've ported the Adafruit LCD library to Energia LM4F (it should be easy to port to MSP430 as well) so I'm using that to display stuff in graphical format.
     
    The code below does a few tricks that might be useful for some of you: a rolling buffer to hold the data, automatic vertical scaling between the minimum and maximum values.
    As always, any kind of feedback is appreciated, I'm still a beginner.
     
    A picture is worth a thousand words. I only have 5 points of resolution in this picture but the vertical scale is actually 20 points.

     
  11. Like
    brainwash reacted to Rei Vilo in StellarPad Pins Assignment   
    Please refer to LaunchPads and BoosterPacks Pins Maps for the updated and maintained pins maps. 
     
    Thank you!
     
    ----
     
    Please find the map for the pins on the StellarPad (aka. LaunchPad Stellaris LM4F).
     
     
     
    Front

     
    Rear
     

     
     
     
    Originals are in Energia wiki at https://github.com/e...a/wiki/Hardware
  12. Like
    brainwash reacted to igor in eLua for Stellaris Launchpad   
    I am working on porting eLua to the Stellaris and Tiva Launchpad.

    eLua is a version of Lua (a scripting language) for microcontrollers.
    Main eLua web site http://www.eluaproject.net/
    eLua works as an interpreter running on the virtual serial port.
    eLua already runs on several of the Stellaris LM3 development kits.

    Source code for my port is available on Github https://github.com/ecdr/elua
    in the LM4 branch
    Current status:

    It compiles (using codesourcery) and runs (i.e. hello world and blinking led work).

    Undergoing testing.

    It is integer only (may not be enough memory for floating point).
    Several peripherals are turned off (no CAN, no I2C).
    [Edit: CAN now turned on]
  13. Like
    brainwash got a reaction from xpg in Energia framework on Eclipse?   
    I've started installing the tools and everything on Eclipse and Win8 and here's the initial guide for beginners like me:
    - install Eclipse Juno CDT or you can add the CDT/gcc/C++ stuff into your existing Java Eclipse (like I did)
    - install MingW and add it to the environment path (c:\MinGW\bin\). Required for make
    - [optional] create a new workspace (I used the existing one) and copy your old energia sketch folder into the workspace
    - find the energia.mk in a post above, copy it to your project folder, rename it to Makefile
    - run the eclipse wizard to create a new project from makefile and specify the project/sketch folder
     
    The "Problems" tab should show that gcc and g++ are not found.
     
    - rightclick on project properties, C/C++ build, Discovery options and rename gcc with msp430-gcc and g++ with msp430-g++
    - on the environment tab append the ..energia\hardware\tools\msp430\bin\ folder to PATH; this is msp430, adjust for stellaris
     
    The "Problems" tab should not show zero errors now.
     
    Right click, project properties, C/C++ build, Environment: add the ENERGIADIR variable !VERY IMPORTANT! replace c:\ with /c/ and backslashes with slashes. It should point to your energia installation folder.
     
    Open the Make targets view and add "all", "boards" and "clean" targets while leaving everything in place.
    Double-click on "boards" and you should have the output in the console.
     
    make boards  Available values for BOARD: lpmsp430g2231  LaunchPad w/ msp430g2231 (1MHz) lpmsp430g2231f LaunchPad w/ msp430g2231 (16MHz) lpmsp430g2452  LaunchPad w/ msp430g2452 (16MHz) lpmsp430g2553  LaunchPad w/ msp430g2553 (16MHz) lpmsp430fr5739 FraunchPad w/ msp430fr5739 Add the ENERGIABOARD env variable (e.g. lpmsp430g2231f) to the project.
     
    Do a clean build and then "all" and the project should compile to an .elf file.
    It's late and I don't have any more time today but the objcopy command is missing, it should compile to a .hex file.
     
    I haven't tried debugging and uploading, maybe someone can continue the 'tutorial'.
     
  14. Like
    brainwash got a reaction from Rei Vilo in Energia framework on Eclipse?   
    I've started installing the tools and everything on Eclipse and Win8 and here's the initial guide for beginners like me:
    - install Eclipse Juno CDT or you can add the CDT/gcc/C++ stuff into your existing Java Eclipse (like I did)
    - install MingW and add it to the environment path (c:\MinGW\bin\). Required for make
    - [optional] create a new workspace (I used the existing one) and copy your old energia sketch folder into the workspace
    - find the energia.mk in a post above, copy it to your project folder, rename it to Makefile
    - run the eclipse wizard to create a new project from makefile and specify the project/sketch folder
     
    The "Problems" tab should show that gcc and g++ are not found.
     
    - rightclick on project properties, C/C++ build, Discovery options and rename gcc with msp430-gcc and g++ with msp430-g++
    - on the environment tab append the ..energia\hardware\tools\msp430\bin\ folder to PATH; this is msp430, adjust for stellaris
     
    The "Problems" tab should not show zero errors now.
     
    Right click, project properties, C/C++ build, Environment: add the ENERGIADIR variable !VERY IMPORTANT! replace c:\ with /c/ and backslashes with slashes. It should point to your energia installation folder.
     
    Open the Make targets view and add "all", "boards" and "clean" targets while leaving everything in place.
    Double-click on "boards" and you should have the output in the console.
     
    make boards  Available values for BOARD: lpmsp430g2231  LaunchPad w/ msp430g2231 (1MHz) lpmsp430g2231f LaunchPad w/ msp430g2231 (16MHz) lpmsp430g2452  LaunchPad w/ msp430g2452 (16MHz) lpmsp430g2553  LaunchPad w/ msp430g2553 (16MHz) lpmsp430fr5739 FraunchPad w/ msp430fr5739 Add the ENERGIABOARD env variable (e.g. lpmsp430g2231f) to the project.
     
    Do a clean build and then "all" and the project should compile to an .elf file.
    It's late and I don't have any more time today but the objcopy command is missing, it should compile to a .hex file.
     
    I haven't tried debugging and uploading, maybe someone can continue the 'tutorial'.
     
  15. Like
    brainwash reacted to Rickta59 in Energia framework on Eclipse?   
    https://github.com/elpaso/energia-makefile
  16. Like
    brainwash reacted to Rickta59 in Energia framework on Eclipse?   
    You don't have to use CCS or TI's compiler to use Eclipse, you can just get the original version of Eclipse and import an existing external makefile project. Eclipse will use all the settings in the makefile and still allow you to use other eclipse facilities including debug.
     

    Note: the picture shows Eclipse Juno IDE using debugging to
    run the Energia ASCIITable.ino example. It is using the
    external makefile from github I mentioned in my previous post.
  17. Like
    brainwash got a reaction from roadrunner84 in [Project] New firmware for coffee machine   
    Just thought I posted my long-time pending project - a replacement chip solution for the Senseo coffee pad machine. It's not 'in production' yet, will do so in the following days, just a bit nervous about playing with line voltages. The machine uses/used a capacitive divider instead of a small transformer, which means that most of the stuff is at line potential with reference to earth. Original voltage regulation is done by clamping 220V through a 5V zener.
    It has been thoroughly tested on the breadboard so it should work once installed.
     
    Hardware - mostly stock, I'm just putting in the MSP430 chip and a regulator. I kept the original board and removed the uC and EEPROM chips.
    - three buttons: power, 1 coffee, 2 coffees
    - the power button has a small red LED circle around it
    - heater controlled via an SCR - NTC thermistor inside the heater is sampled through a voltage divider.
    - water sensor is a hall type sensor that detects the floater position inside the water tank
    - water pump is controlled via a small transistor
     
    Operation:
    - while line voltage is on but the machine is powered off the user can enter service modes via button combinations
    - upon powering on the machine starts heating the water, displaying on the LED how hot the water is (PWM)
    - if the user requests a coffee, the machine changes is blinking pattern and starts making a coffee once the water is heated
    - if there is no water in the tank there is a faster blinking pattern
    - if no user input is detected for 30 minutes the machine goes to power off state
    - a lot of other safety stuff and under the hood stuff that you kind of expect to work
     
    Why?
    The original machine annoyed me (and my work mates) for various reasons:
    - once plugged in, it stayed off, so if you used a remote outlet you have to physically move yourself to power on the machine, making the remote outlet kind of useless
    - heating the water takes quite a lot of time (90s) and you cannot request a coffee in advance
    - that 90s seems like forever because you have no indication how far you are from the target temperature; the led just blinks and then settles to an ON state
    - if left unused for a while, the boiler temperature goes down quite a lot; this makes the next coffee colder than normal
     
    Things to do after real-world testing is complete:
    - the 2 coffee button is not implemented yet, not sure it is needed. Two presses of the other button achieve exactly the same thing and the water does not cool so much
    - LPM3/4. Probably not needed, but I will test initially with a separate battery supply.
    - water quantity calibration via a service mode. You should be able to increase/decrease the pump duration in 1 second increments via a service mode and the value saved in flash. The original chip did this
    - add a jumper or some kind of configuration mode where you can have the machine prepare a coffee once it's powered on, for remote controlled outlet usage
     
    If anyone needs more details I can provide them here; I will eventual make a dedicated blog post with tons of pictures and graphs about this.
    Strangely enough I cannot attach .ino files and the code tag seems broken.
    senseopad.ino.txt
  18. Like
    brainwash got a reaction from energia in [Project] New firmware for coffee machine   
    Just thought I posted my long-time pending project - a replacement chip solution for the Senseo coffee pad machine. It's not 'in production' yet, will do so in the following days, just a bit nervous about playing with line voltages. The machine uses/used a capacitive divider instead of a small transformer, which means that most of the stuff is at line potential with reference to earth. Original voltage regulation is done by clamping 220V through a 5V zener.
    It has been thoroughly tested on the breadboard so it should work once installed.
     
    Hardware - mostly stock, I'm just putting in the MSP430 chip and a regulator. I kept the original board and removed the uC and EEPROM chips.
    - three buttons: power, 1 coffee, 2 coffees
    - the power button has a small red LED circle around it
    - heater controlled via an SCR - NTC thermistor inside the heater is sampled through a voltage divider.
    - water sensor is a hall type sensor that detects the floater position inside the water tank
    - water pump is controlled via a small transistor
     
    Operation:
    - while line voltage is on but the machine is powered off the user can enter service modes via button combinations
    - upon powering on the machine starts heating the water, displaying on the LED how hot the water is (PWM)
    - if the user requests a coffee, the machine changes is blinking pattern and starts making a coffee once the water is heated
    - if there is no water in the tank there is a faster blinking pattern
    - if no user input is detected for 30 minutes the machine goes to power off state
    - a lot of other safety stuff and under the hood stuff that you kind of expect to work
     
    Why?
    The original machine annoyed me (and my work mates) for various reasons:
    - once plugged in, it stayed off, so if you used a remote outlet you have to physically move yourself to power on the machine, making the remote outlet kind of useless
    - heating the water takes quite a lot of time (90s) and you cannot request a coffee in advance
    - that 90s seems like forever because you have no indication how far you are from the target temperature; the led just blinks and then settles to an ON state
    - if left unused for a while, the boiler temperature goes down quite a lot; this makes the next coffee colder than normal
     
    Things to do after real-world testing is complete:
    - the 2 coffee button is not implemented yet, not sure it is needed. Two presses of the other button achieve exactly the same thing and the water does not cool so much
    - LPM3/4. Probably not needed, but I will test initially with a separate battery supply.
    - water quantity calibration via a service mode. You should be able to increase/decrease the pump duration in 1 second increments via a service mode and the value saved in flash. The original chip did this
    - add a jumper or some kind of configuration mode where you can have the machine prepare a coffee once it's powered on, for remote controlled outlet usage
     
    If anyone needs more details I can provide them here; I will eventual make a dedicated blog post with tons of pictures and graphs about this.
    Strangely enough I cannot attach .ino files and the code tag seems broken.
    senseopad.ino.txt
  19. Like
    brainwash got a reaction from xpg in [Project] New firmware for coffee machine   
    Just thought I posted my long-time pending project - a replacement chip solution for the Senseo coffee pad machine. It's not 'in production' yet, will do so in the following days, just a bit nervous about playing with line voltages. The machine uses/used a capacitive divider instead of a small transformer, which means that most of the stuff is at line potential with reference to earth. Original voltage regulation is done by clamping 220V through a 5V zener.
    It has been thoroughly tested on the breadboard so it should work once installed.
     
    Hardware - mostly stock, I'm just putting in the MSP430 chip and a regulator. I kept the original board and removed the uC and EEPROM chips.
    - three buttons: power, 1 coffee, 2 coffees
    - the power button has a small red LED circle around it
    - heater controlled via an SCR - NTC thermistor inside the heater is sampled through a voltage divider.
    - water sensor is a hall type sensor that detects the floater position inside the water tank
    - water pump is controlled via a small transistor
     
    Operation:
    - while line voltage is on but the machine is powered off the user can enter service modes via button combinations
    - upon powering on the machine starts heating the water, displaying on the LED how hot the water is (PWM)
    - if the user requests a coffee, the machine changes is blinking pattern and starts making a coffee once the water is heated
    - if there is no water in the tank there is a faster blinking pattern
    - if no user input is detected for 30 minutes the machine goes to power off state
    - a lot of other safety stuff and under the hood stuff that you kind of expect to work
     
    Why?
    The original machine annoyed me (and my work mates) for various reasons:
    - once plugged in, it stayed off, so if you used a remote outlet you have to physically move yourself to power on the machine, making the remote outlet kind of useless
    - heating the water takes quite a lot of time (90s) and you cannot request a coffee in advance
    - that 90s seems like forever because you have no indication how far you are from the target temperature; the led just blinks and then settles to an ON state
    - if left unused for a while, the boiler temperature goes down quite a lot; this makes the next coffee colder than normal
     
    Things to do after real-world testing is complete:
    - the 2 coffee button is not implemented yet, not sure it is needed. Two presses of the other button achieve exactly the same thing and the water does not cool so much
    - LPM3/4. Probably not needed, but I will test initially with a separate battery supply.
    - water quantity calibration via a service mode. You should be able to increase/decrease the pump duration in 1 second increments via a service mode and the value saved in flash. The original chip did this
    - add a jumper or some kind of configuration mode where you can have the machine prepare a coffee once it's powered on, for remote controlled outlet usage
     
    If anyone needs more details I can provide them here; I will eventual make a dedicated blog post with tons of pictures and graphs about this.
    Strangely enough I cannot attach .ino files and the code tag seems broken.
    senseopad.ino.txt
  20. Like
    brainwash got a reaction from energia in AD9850 with Energia   
    Very simple code to get the AD9850 [ebay] module up and running. I will use Energia whenever possible because it results in more portable code.
     
    /* Using the AD9850 DDS ebay module with Stellaris Launchpad. Code based on http://nr8o.dhlpilotcentral.com/?p=83 and https://gist.github.com/raivisr/3861473 PA2 - W_CLK PA3 - FQ_UD PA4 - DATA PB6 - RESET VCC - VCC (5V can also be used but will dissipate more heat) GND - GND Serial comms - 9600, NewLine (0x0A) denotes end of input, f 10000 - set frequency s 20 20000 10 1000 - sweep from frequency to frequency using this step size in that many milliseconds o 10 10000 5 3000 - oscillating sweep from frequency to frequency and back using this step size in that many ms */ #define MAXBUF 40 #define W_CLK PA_2 // Pin 8 - connect to AD9850 module word load clock pin (CLK) #define FQ_UD PA_3 // Pin 9 - connect to freq update pin (FQ) #define DATA PA_4 // Pin 10 - connect to serial data load pin (DATA) #define RESET PB_6 // Pin 11 - connect to reset pin (RST). #define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); } // transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line void tfr_byte(byte data) { for (int i=0; i<8; i++, data>>=1) { digitalWrite(DATA, data & 0x01); pulseHigh(W_CLK); //after each bit sent, CLK is pulsed high } } // frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32 void sendFrequency(double frequency) { int32_t freq = frequency * 4294967295/125000000; // note 125 MHz clock on 9850 for (int b=0; b<4; b++, freq>>=8) { tfr_byte(freq & 0xFF); } tfr_byte(0x000); // Final control byte, all 0 for 9850 chip pulseHigh(FQ_UD); // Done! Should see output } double freqValue = 0; double freqStart = 0; double freqEnd = 0; double freqStep = 0; int sweepDelay = 0; char freqStr[MAXBUF]; int bufPos = 0; char byteIn = 0; int mode = 0; void setup() { // configure arduino data pins for output pinMode(FQ_UD, OUTPUT); pinMode(W_CLK, OUTPUT); pinMode(DATA, OUTPUT); pinMode(RESET, OUTPUT); pulseHigh(RESET); pulseHigh(W_CLK); pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10 Serial.begin(9600); memset(freqStr,0,sizeof(freqStr)); sendFrequency(1e7); } void loop() { if (mode == 1 || mode == 2) { delay(sweepDelay); if (((freqStep > 0.0) && (freqValue + freqStep <= max(freqStart,freqEnd))) || ((freqStep < 0.0) && (freqValue + freqStep >= min(freqStart,freqEnd)))) freqValue += freqStep; else if (mode == 1) freqValue = freqStart; else { freqStep *= -1; freqValue += freqStep; } sendFrequency(freqValue); } while (Serial.available()) { byteIn = Serial.read(); if (bufPos < sizeof(freqStr)) freqStr[bufPos++] = byteIn; else { bufPos = 0; byteIn = 0; memset(freqStr,0,sizeof(freqStr)); Serial.println("Command too long. Ignored."); } } if (byteIn == 0x0a) { switch (freqStr[0]) { case 'f': mode = 0; freqValue = strtod(freqStr+2,NULL); freqEnd = 0; freqStep = 0; sweepDelay = 0; Serial.print("Frequency "); Serial.println(freqValue); break; case 's': case 'o': char *fEnd1, *fEnd2; freqStart = abs(strtod(freqStr+2,&fEnd1)); freqEnd = abs(strtod(fEnd1,&fEnd2)); freqStep = abs(strtod(fEnd2,&fEnd1)); if (freqStep == 0) { Serial.println("You gotta be kidding me, step can not be 0"); break; } sweepDelay = abs(atoi(fEnd1)); if (freqStr[0] == 's') { mode = 1; Serial.print("Sweep"); } else { mode = 2; Serial.print("Oscillate sweep"); } Serial.print(" start freq. "); Serial.print(freqStart); Serial.print(" end freq. "); Serial.print(freqEnd); Serial.print(" step "); Serial.print(freqStep); Serial.print(" time "); Serial.println(sweepDelay); sweepDelay /= abs(freqEnd - freqStart) / freqStep; if (mode == 2) sweepDelay /= 2; if (freqStart > freqEnd) freqStep *= -1; freqValue = freqStart; break; default: Serial.println("AI blown up - unknown command. Available commands:"); Serial.println(" f 10000 - set frequency"); Serial.println(" s 20 20000 10 1000 - sweep from frequency to frequency using this step size in that many milliseconds"); Serial.println(" o 10 10000 5 3000 - oscillating sweep from frequency to frequency and back using this step size in that many ms"); Serial.println(" frequency can be given in floating point format: 1.23456e7"); } memset(freqStr,0,sizeof(freqStr)); byteIn = 0; bufPos = 0; sendFrequency(freqValue); } }  
     
  21. Like
    brainwash got a reaction from bluehash in LM4F120 PWM   
    Just remember to add the line
     
    HWREG(TIMER0_BASE + TIMER_O_TAMR) |= (TIMER_TAMR_TAMRSU | TIMER_TAMR_TAPLO | TIMER_TAMR_TAILD);
     
    if you bump into problems. It is in the comments section of that blog post.
  22. Like
    brainwash got a reaction from bluehash in AD9850 with Energia   
    Very simple code to get the AD9850 [ebay] module up and running. I will use Energia whenever possible because it results in more portable code.
     
    /* Using the AD9850 DDS ebay module with Stellaris Launchpad. Code based on http://nr8o.dhlpilotcentral.com/?p=83 and https://gist.github.com/raivisr/3861473 PA2 - W_CLK PA3 - FQ_UD PA4 - DATA PB6 - RESET VCC - VCC (5V can also be used but will dissipate more heat) GND - GND Serial comms - 9600, NewLine (0x0A) denotes end of input, f 10000 - set frequency s 20 20000 10 1000 - sweep from frequency to frequency using this step size in that many milliseconds o 10 10000 5 3000 - oscillating sweep from frequency to frequency and back using this step size in that many ms */ #define MAXBUF 40 #define W_CLK PA_2 // Pin 8 - connect to AD9850 module word load clock pin (CLK) #define FQ_UD PA_3 // Pin 9 - connect to freq update pin (FQ) #define DATA PA_4 // Pin 10 - connect to serial data load pin (DATA) #define RESET PB_6 // Pin 11 - connect to reset pin (RST). #define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); } // transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line void tfr_byte(byte data) { for (int i=0; i<8; i++, data>>=1) { digitalWrite(DATA, data & 0x01); pulseHigh(W_CLK); //after each bit sent, CLK is pulsed high } } // frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32 void sendFrequency(double frequency) { int32_t freq = frequency * 4294967295/125000000; // note 125 MHz clock on 9850 for (int b=0; b<4; b++, freq>>=8) { tfr_byte(freq & 0xFF); } tfr_byte(0x000); // Final control byte, all 0 for 9850 chip pulseHigh(FQ_UD); // Done! Should see output } double freqValue = 0; double freqStart = 0; double freqEnd = 0; double freqStep = 0; int sweepDelay = 0; char freqStr[MAXBUF]; int bufPos = 0; char byteIn = 0; int mode = 0; void setup() { // configure arduino data pins for output pinMode(FQ_UD, OUTPUT); pinMode(W_CLK, OUTPUT); pinMode(DATA, OUTPUT); pinMode(RESET, OUTPUT); pulseHigh(RESET); pulseHigh(W_CLK); pulseHigh(FQ_UD); // this pulse enables serial mode - Datasheet page 12 figure 10 Serial.begin(9600); memset(freqStr,0,sizeof(freqStr)); sendFrequency(1e7); } void loop() { if (mode == 1 || mode == 2) { delay(sweepDelay); if (((freqStep > 0.0) && (freqValue + freqStep <= max(freqStart,freqEnd))) || ((freqStep < 0.0) && (freqValue + freqStep >= min(freqStart,freqEnd)))) freqValue += freqStep; else if (mode == 1) freqValue = freqStart; else { freqStep *= -1; freqValue += freqStep; } sendFrequency(freqValue); } while (Serial.available()) { byteIn = Serial.read(); if (bufPos < sizeof(freqStr)) freqStr[bufPos++] = byteIn; else { bufPos = 0; byteIn = 0; memset(freqStr,0,sizeof(freqStr)); Serial.println("Command too long. Ignored."); } } if (byteIn == 0x0a) { switch (freqStr[0]) { case 'f': mode = 0; freqValue = strtod(freqStr+2,NULL); freqEnd = 0; freqStep = 0; sweepDelay = 0; Serial.print("Frequency "); Serial.println(freqValue); break; case 's': case 'o': char *fEnd1, *fEnd2; freqStart = abs(strtod(freqStr+2,&fEnd1)); freqEnd = abs(strtod(fEnd1,&fEnd2)); freqStep = abs(strtod(fEnd2,&fEnd1)); if (freqStep == 0) { Serial.println("You gotta be kidding me, step can not be 0"); break; } sweepDelay = abs(atoi(fEnd1)); if (freqStr[0] == 's') { mode = 1; Serial.print("Sweep"); } else { mode = 2; Serial.print("Oscillate sweep"); } Serial.print(" start freq. "); Serial.print(freqStart); Serial.print(" end freq. "); Serial.print(freqEnd); Serial.print(" step "); Serial.print(freqStep); Serial.print(" time "); Serial.println(sweepDelay); sweepDelay /= abs(freqEnd - freqStart) / freqStep; if (mode == 2) sweepDelay /= 2; if (freqStart > freqEnd) freqStep *= -1; freqValue = freqStart; break; default: Serial.println("AI blown up - unknown command. Available commands:"); Serial.println(" f 10000 - set frequency"); Serial.println(" s 20 20000 10 1000 - sweep from frequency to frequency using this step size in that many milliseconds"); Serial.println(" o 10 10000 5 3000 - oscillating sweep from frequency to frequency and back using this step size in that many ms"); Serial.println(" frequency can be given in floating point format: 1.23456e7"); } memset(freqStr,0,sizeof(freqStr)); byteIn = 0; bufPos = 0; sendFrequency(freqValue); } }  
     
  23. Like
    brainwash reacted to bluehash in TV Out   
    Thanks for sharing. This is a good first try.
    There are a projects over at 43oh doing this exact same thing... probably help you out:
    http://forum.43oh.com/topic/208-launchpad-tv-output/
  24. Like
    brainwash reacted to yyrkoon in CCSv4 vs Energia   
    I've done some Code::Blocks + Energia toolchain video's on how to set up the two together. The link to my youtube videos(My channel actually ) is listed below, and you're welcome to take a look at them.
     
    However, with my own limited experience with Eclipse, and far more experience with the Energia tool chain. There is no reason why you can not set up the Energia toolchain with Eclipse. CCS while possibly not impossible would be far more of a pain to setup with the Energia toolchain. As far as I could tell, and I did not spend too much time looking into it, but despite the fact that CCS is Eclipse based. Most of the compiler tools, or CCS specific bits and pieces seem to be obfusticated TI specific plug ins. So if you think Eclipse + Energia tool chain is a nightmare to setup . . . yeah forget about it.
     
    Maybe in the future I will even do a video "blog" of how to setup the Energia tool chain with Eclipse. It should not be too hard to configure, as I've spent a lot of time the last month or so bouncing between Code::Blocks, and Visual Studio trying to get something I like, working. Between both Code::Blocks, and Visual Studio, both have their pluses for the given purpose. With me currently favoring Visual Studio for its code completion / syntax highlighting. I will definitely be doing some video's pertaining to Visual Studio in the future. Plus I have plans on writing an intermediate tool to help make things painless between the toolchain, and Visual Studio.
  25. Like
    brainwash got a reaction from bluehash in TV Out   
    I had this idea after finding out there are no TV Out libraries for the Stellaris Launchpad. Well, after two days of hair pulling I can almost imagine why. It's very hard to do timing accurate things on this uC and a lot of unknown stuff gets in your way.
    I got pretty far with the implementation, I'll have to see if I will do some more with it. Rather, I'm hoping that the community will chime in and support this feature, so if there is enough interest and able coders we might set up some some source community project (google code / github / sourceforge / ...).
    Problems:
    - some white streaks on the sides, caused by some peripherals. I'm using only two resistors as "the hardware" so they might pick up some noise from uC.
    - slight vertical jitter. This is kind of expected because I did not want to do loop counting
    - oscilloscope loses sync sometimes, this means that timing is off
    - no double buffering. I'm using a large array (~21k) as a buffer and it's not packed at all
    - code style: I'm pretty new to the embedded world so I appreciate any kind of feedback you have to offer. I might have reinvented the wheel in some places
     
    It's a flickering bouncing box.
     
     
    Any contribution is appreciated, I can provide the hex file if someone wants to try it. It has only been tested with a small beamer.
    tvout_test.c




×
×
  • Create New...