Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by roadrunner84

  1. 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 b
  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 experie
  3. //#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. lwip has fairly nice layers, you should be able to send raw ethernet packets using ethernet_output() as defines in netif/ethernet.h
  5. 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. 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
  7. 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. 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. 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. 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 turne
  11. 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. @@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. 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. 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 u
  15. 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 an
  16. 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. 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 to
  18. 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 you
  19. 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.
  20. 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.
  21. 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.
  22. 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
  23. 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
  • Create New...