Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by roadrunner84

  1. roadrunner84

    String conversion problem

    Energia stores strings to be sent over serial in a buffer and sends them after running an iteration through loop(). Best thing to do is stop using LPM4 (which kills off every clock domain) and see if things work. Then, if things work, try using LPM1, then LPM3, not LPM4. If you still have issues, the quickest solution is to delay a while after sending things over serial to make sure it's sent before going to low power mode. The problem with your reprogramming of the chip (I assume you're trying to update the programmer, not the msp430 itself) is you're using Windows 9, which has never been released for consumers. Try either upgrading to Windows 10 or downgrading to Windows 7. If that doesn't work, try to reinstall the drivers or using a different USB port.
  2. There is nothing indicating the TI compiler will be phased out. But with the plethora of ARM compilers available, I can imagine TI stopping support for their compiler and focus effort elsewhere. I don't think compilers are TI's core business, nor are software packages. A lot of MCU vendors now provide peripheral setup utilities (like TI's Grace or ST's Cube) and IDEs for free; it's a complementary service for using their MCUs. Pure compiler vendors charge you for their environment of course, since it's their business model. They need to put all effort in providing a better development experience or easier code generation or better libraries than their competitors, not something TI should (IMO) focus on. TI is a hardware vendor; they build the best analog and radio chips they can, as well as a huge range of analogs complemented with a nice collection of MCUs and CPUs. That is where their focus is, not on tools to use those things.
  3. roadrunner84

    PWM from ADC joystick

    //#include <msp430.h> #include <msp430g2553.h> /* * main.c */ void main(void) { //int adcValue; WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer //This is ADC10 control register //4th bit turns on ADC //11 and 12 sets "16
  4. roadrunner84

    Seding raw Ethernet socket

    lwip has fairly nice layers, you should be able to send raw ethernet packets using ethernet_output() as defines in netif/ethernet.h
  5. roadrunner84

    Basic MSP430 GPIO Macros

    I do agree that code should be readable. Bet then again, there's a trade off between readable low-level code and readable business logic. I'd much rather see some unclear macros or templates to allow me to use cleaner calls in my "real" program, than have a murky program that reads like a book. Things like set_pin_as_output() and set_high() are quite clear in their intention, it's okay to take a while to understand their inner workings, as long as the code using it is more readable thanks to using them.
  6. roadrunner84

    Basic MSP430 GPIO Macros

    You could consider using C++ template programming instead of C style defines. I haven't tested this, but it would go something like this: template <int port> void GPIO_IS_INPUT(int pin) { GPIO_SEL(port) &= ~(pin); GPIO_DIR(port) &= ~(pin); } template <> void GPIO_IS_INPUT<J>(int pin) { GPIO_DIR(J) &= ~(pin); } Now instead of passing port as a macro like function parameter, pass it as a template parameter GPIO_IS_INPUT<LED1_PORT>(LED1_PIN); I'm not entirely sure this will work though; the double-hash preprocessor operator is very tricky. You could go all the way with these templates and get gone with the macros entirely. If you really want no function call overhead, just make them inline.
  7. roadrunner84

    I2C for beginners

    I condensed the comment in the referral in the referral from @@LiviuM their post. It boils down to two things to check: Call Wire.setModule(0) just before Wire.begin() Remove the jumper for LED2 (P1.6) next to S2
  8. roadrunner84

    V7 embedded JavaScript engine is ported to MSP432

    Javascript is a very nice language, I see no reason to say Python has a place on an embedded system, but Javascript doesn't. Both of them are high level languages which offer great flexibility. I do agree both are quite heavy and for dedicated solutions I'd urge using C++ over Python/Javascript, but I think it's the most elegant solution over a self-made scripting language for things like home automation.
  9. roadrunner84

    I2C for beginners

    First of all, I2C has this oddity of using 7 bit addresses. When representing 7 bits in an 8 bit byte, it's never clear where to add the extra zero bit. Your device address is 1001xxx But does this translate to 01010xxx or to 1010xxx0 try using 89h instead of A2h, it might just work. Next thing, when writing 16 bit values over an 8 bit bus, make sure you have thew byte order (also called endianness) correct. Does 00FFh 0000000011111111 translate to 00h, FFh 00000000 11111111 or to FFh, 00h 11111111 00000000 so you could try either (or read back both addresses).
  10. roadrunner84

    MSP430G2553 low power or send to sleep

    I made this exact setup a few years back. I actually used two buttons and two LEDs, and I embedded it in a toy kitchen. If I remember correctly, I used an msp430g2230 for the task, that's an 8 pin msp430. I did not use Energia for this project, but IAR, similar to CCS. There were some extra features, for example the LEDs were pulsed, and the pulses of the LEDs were 180 out of phase as to load the battery as evenly as possible. I used both LPM3 and LPM4 for this task; while an LED was on, I went to LPM3 to allow a timer to keep running. Then when the timer expired (and thus the LEDs are turned off) I go to LPM4 which should use about 200nA on that processor. I don't know if it is really that low, I don't own a nanoamp meter.
  11. roadrunner84

    Can SoftwareSerial library work with msp430g2553

    No it doesn't. It does have a dual serial interface, but only one can be set to UART, the other can be set to I2C, both can be set as SPI.
  12. roadrunner84

    It's Halloween Again

    @@Fmilburn Nice wearable pcb! Would you consider replacing the 6-pin header with the 0.05" 4 pin header, or maybe even a tagconnect? then it would be even better looking and less susceptible to getting stuck to clothing with the header. You might even squeeze in one or two extra pads!
  13. roadrunner84

    Can SoftwareSerial library work with msp430g2553

    It looks like you're using software serial, but try to initialize your GPS module using hardware serial. Should the setup not call nss.write() all the time, instead of Serial.write()?
  14. roadrunner84

    Reading data from 3.5mm audio jack

    I was talking about OOK (on-off keying), while your latest schematic is talking about FSK (frequency shift keying). The difference is that FSK will send one frequency for high bits and another for low bits, while OOK will send one frequency for high bits and no frequency (DC, 0Hz) for low bits (or the other way around). So FSK has the added value of distinguishing high/low bits from an idle line. In the case of UART serial, you don't need this detection per se, because a high bit and an idle line are not distinguishable anyway. Then again, if you have the software to do FSK, just use it. If you make things from scratch, OOK might prove simpler to implement.
  15. roadrunner84

    Reading data from 3.5mm audio jack

    Easiest way is to use an opamp (there are msp430 with built in comparator/opamp) and use/abuse the opamp as a filter. Then "encode" serial commands (you have to go serial at some point!) by transmitting high bits as one frequency and low bits as another frequency (or no signal at all). Then you can use the output from the filter to acquire an analog voltage that is close to the desired levels. Essentially you're using discrete amplitude modulation (AM) with a modulation depth of 100%, this is the same as OOK (on-off keying). Note that such a system will have a low bandwidth, don't expect any rate in the order of kilobits. Also, you can see that this is roughly what the softmodem solution is doing; taking a signal, filtering it and shoving it down the msp's throat.
  16. roadrunner84

    GPIO on CC3200 with Energia

    Does this help? Note that the LEDs are labeled to be connected to pin 9, 10 and 29 for yellow green and red resp.
  17. roadrunner84

    What's more precise: UART via crystal or DCO?

    You can make FLL in software, this is the basic process. Count a set number of LFXT/ACLK ticks in DCO/SMCLK ticks: Set a timer (can be the watchdog) to fire every X ticks of ACLK, set another timer to run on SMCLK. Reset both timers. Sample the second timer when the first timer fires. Now you know how many SMCLK ticks go in X ACLK ticks, since ACLK is derived from the LFXT, you can tune your DCO (SMCLK source) to get closer to the desired value. This of course takes time, time you may not have. But if you can spare a bit, add this FLL before every message you send over UART. If that's too heavy, sample every second or minute. Alternatively (if you don't need the reset on watchdog) have the timers run continuously in the background and do this stuff in the ISR.
  18. roadrunner84

    What's more precise: UART via crystal or DCO?

    The lower your source clock frequency, the less accurate you can tune your baud rate. So using a 32kiHz source would be less favourable. But the crystal is more stable than an RC oscillator (like the DCO), even if the RC oscillator is temperature compensated. So using a high frequency source (like the DCO) will help you get a more accurate clock, but it would be less stable than using the crystal. The best way would be to regularly tune your internal oscillator to a stable external crystal clock source. This is where PLL comes in to play. I think you can use the LFXT as a PLL source to your DCO, but I'm not sure. As you may have noticed, I kept talking about stability and accuracy, not about reliability. If you want your UART to be reliable, you would prefer the baud rate to be as close to the desired baud rate as possible, with as little jitter or drift as possible. For real world scenarios, that drift and jitter is barely a problem when using a baud rate as low as 9600Bdps. Also note that in the case of the msp430g2 Launchpad, you cannot go higher without using an external UART to your PC or other peripheral, because the emulator does not support higher baud rates. I'd err on using the DCO over the LFXT, because you can get a better approximation of the desired baud rate.
  19. roadrunner84

    Suggestions for Development kit for students

    How about the Educational Boosterpack MkII?
  20. True, but lowing the voltage to 1.8V forces you to lower the clockspeed in those slivers of time you're not in LPM4, because you can't run at high speeds on that low a voltage.
  21. roadrunner84

    EXP430(G2553) Problem with Timer1 using ACLK (SOLVED)

    As I read the datasheet, after P2SEL = BIT6; P2.6 will be a timer output, but only if you write P2DIR = PIN6; too. So your crystal isn't oscillating anymore. If you write P2SEL |= BIT6; the crystal will be functioning because you set a bit that was already set. But if you add P2DIR |= BIT6; then you switch to an undescribed situation; it looks like you want the pin to behave like XOUT, not XIN.
  22. As on page 23 of the datasheet you should lower the voltage of your device as much as possible, probably to 1.8V to attain the lowest power consumption possible, as well as the temperature. Even then, the typical current is 0.1uA, the max is 0.5uA.
  23. roadrunner84

    EXP430(G2553) Problem with Timer1 using ACLK (SOLVED)

    I think your problem is related to the crystal. The crystal is connected to P2.6 and P2.7, but you overwrite P2SEL and P2DIR with non-default values. As a result, the crystal is not controlled correctly anymore and ACLK is dead. To avoid this problem, try to use |= and &=~ as much as possible to set or clear bits. P1SEL |= BIT1; // set SEL1 bit 1 P1SEL &= ~BIT2; // clear SEL1 bit 2 P1SEL |= (BIT1 | BIT2); // set SEL1 bit 1 and 2 P1SEL &= ~(BIT1 | BIT2); // clear SEL1 bit 1 and 2 P1SEL = (P1SEL | BIT1) & ~BIT2; // set SEL1 bit 1 and clear bit 2
  24. roadrunner84

    Could I please have some help.

    the #define lines make pre-compiler defines, they mean that every time you write the first name, it is replaced with the rest of that line. So #define Run_value 1 means that from that point on, all occurrences of Run_value should be read as if there was the literal value 1. C and C++ are case sensitive, that means that Run_value is a different name than Run_Value. To store some value, you must store it in a variable. The easiest to use variables are integers, whom are written as int: int Run_value; To assign a value to a variable, you use a single equal sign. To compare them you use a double equal sign: Run_value = 0; while (Run_value == 1) { // your code here } These are some basic C/C++ things to know. --------------------------------------------- Now for some more considerations: floating point (the underlying implementation of non-integer numbers) numbers are never accurate. This is OK, it just means you should never make equal-to comparisons, nor assume there is no gap between two numbers. In your code you write two mutually exclusive if cases, but there is an else statement you could use instead. if (Scaled_value <= 10.0) { Run_value = 1; //while this equals 1 the screen will display voltage reading } else { Run_value = 0; //while this equals 0 the screen will display max voltage } Then another issue to realize is that C/C++ run linear. So if you set Run_value to 1, it won't change until you actively change it. For example by moving code execution to pass through this test again. In your code, you have this snippet. if (Scaled_value <= 10.0) { Run_Value = 1; //while this equals 1 the screen will display voltage reading } if (Scaled_value > 10.0) { Run_Value = 0; //while this equals 0 the screen will display max voltage } while (Run_value = 1) { // Show voltage readout on screen _ while (Run_value = 0) { //Show Max voltage on screen } } You could change it to while (1) { if (Scaled_value <= 10.0) { Run_value = 1; //while this equals 1 the screen will display voltage reading } else { Run_value = 0; //while this equals 0 the screen will display max voltage } if (Run_value == 1) { // Show voltage readout on screen } else { //Show Max voltage on screen } } This still could be simpler, but I tried to stay as close to your code as possible. -------------------------------------------------- As a last note. If this is your first programming experience, tell your teacher. This is not even close to a 101 class exercise. You may expect him to give you a smoother introduction to programming.