Jump to content


  • Content count

  • Joined

  • Last visited

About nixnerd3

  • Rank

Profile Information

  • Location
  1. Energia Hybrid Code

    Hi Bob, Again, thank you very much for your input. Hmm...I'll probably do a little of each step you've outlined. And I'll keep the mantra of "If it was easy anyone could do it" in mind. all, again, thank you for your help! Scott
  2. Energia Hybrid Code

    All, Thanks for raining on my parade Seriously, though, thank you for your input. One thing I should've mentioned is this is for pedagogical purposes, not for development. For example, it might make a good demo for MOOC to show students a level up from the "real" code, but not requiring a lot of skill with using libraries, include paths, linking, etc. Probably the easiest thing for me to do is get to know the Energia library better. Other than that, maybe you can help me figure out an easier way to debug.The Energia code is very robust, easy to use, yes, but it can take some time for new user to make their way thru the labyrinth of references. Just to give you a concrete example, consider this line in wiring_analog.c: uint16_t analogRead(uint8_t pin) { // make sure we have an ADC uint8_t channel; // Check if pin is a special analog pin (A10 = temp sensor, A11 = Vcc/2, etc.) if (pin >=128) channel = pin - 128; else channel = digitalPinToADCIn(pin); The question becomes, where is digitalPinToADC() defined? Well, after poking around a bit, I find it's a #define (what would I do without grep?) in: grep digitalPinToADCIn hardware/energia/cores/msp430/* Energia.h:#define digitalPinToADCIn(P) ( digital_pin_to_analog_in[P] ) So, searching around a bit more, I find digital_pin_to_analog_in[] is an array declared in hardware/energia/msp430/variants/MSP-EXP430G2553LP/pins_enerigia.h const uint32_t digital_pin_to_analog_in[] = { NOT_ON_ADC, /* dummy */ NOT_ON_ADC, /* 1 - 3.3V*/ 0, /* 2 - A0 */ 1, /* 3 - A1 */ 2, /* 4 - A2 */ 3, /* 5 - A3 */ 4, /* 6 - A4 */ 5, /* 7 - A5 */ NOT_ON_ADC, /* 8 - P2.0 */ NOT_ON_ADC, /* 9 - P2.1 */ NOT_ON_ADC, /* 10 - P2.2 */ NOT_ON_ADC, /* 11 - P2.3 */ NOT_ON_ADC, /* 12 - P2.4 */ NOT_ON_ADC, /* 13 - P2.5 */ 6, /* 14 - A6 */ 7, /* 15 - A7 */ NOT_ON_ADC, /* 16 - RST */ NOT_ON_ADC, /* 17 - PF0 */ NOT_ON_ADC, /* 18 - PE0 */ NOT_ON_ADC, /* 19 - PB2 */ NOT_ON_ADC /* 20 - GND */ }; The gripe I have with this is that it's hard to debug using #defines. It's easier with const, of course. Code Composer has no idea what digitalPinToADC() is, but it will tell you what digital_pin_to_analog_in is. You and I don't have a problem with this (although we might be somewhat bemused), students will stumble. I think what I'd like to see is just one example (say, just for the 2553 Launchpad) written in a bare-bones, flat, not much error-checking, but still using a structured C++ style like Energia code for some of the Energia examples. Does that make sense? thank again!
  3. Energia Hybrid Code

    Hi all, I started writing a few "hybrid" code examples based on Energia projects. They're called hybrid because they're based on Energia examples but are written more of a compact form, using few header files. For example, they do not try to hide the main() routine like Arduino/Energia (this is great for beginners/prototypers, but not for understanding the microprocessor). Energia and CCS examples are somewhat complementary: Energia is easy to use/hard to follow, TI code is hard to use/easy to follow. Hi-level vs. low-level. So I wanted something in between. Hence, hybrid. They are written with the intent to expose the underlying details, not to try to hide them like Arduino/Energia paradigm. The intent is to make them self-contained without too many header files. One significant departure is to specify ports in the TI style of P1.x instead of mapping them to single numbers (P1.0 = 1, etc) . Not sure if that's a bad idea. Here is a rough draft of Blinky: #include <msp430.h> typedef unsigned char uint8_t; typedef enum _val {LOW, HIGH} _val_t; typedef enum _dir {INPUT, OUTPUT} _dir_t; void disableWatchDog() { WDTCTL = WDTPW | WDTHOLD; } void init() { disableWatchDog(); } void pinMode(uint8_t port, uint8_t pin, _dir_t dir){ volatile unsigned char* _base_addr = &P1DIR; //base starting address volatile unsigned char* _port_addr; //final calculated addr uint8_t offset; // port address equals base plus offset offset = (port - 1) << (port + 1); // each port seperated by 8 bytes, hence shift a 1 by 2^3 _port_addr = _base_addr + offset; uint8_t mask = 1<<pin; (dir == INPUT) ? (*_port_addr &= ~mask) : (*_port_addr |= mask); //set or reset bit } void setup() { uint8_t port = 1; //Port 1.0 uint8_t pin =0; pinMode(port, pin, OUTPUT); } void digitalWrite(uint8_t port, uint8_t pin, _val_t val) { volatile unsigned char* _base_addr = &P1OUT; volatile unsigned char* _port_addr; //final calculated addr uint8_t offset; // port address equals base plus offset offset = (port - 1) << (port + 1); // each port seperated by 8 bytes, hence shift a 1 by 2^3 uint8_t mask = 1<<pin; _port_addr = _base_addr + offset; (val == LOW) ? (*_port_addr &= ~mask) : (*_port_addr |= mask); //set or reset bit } // the loop routine runs over and over again forever: void loop() { uint8_t port = 1; //Port 1.0 uint8_t pin =0; digitalWrite(port, pin, HIGH); // turn the LED on (HIGH is the voltage level) __delay_cycles(50000); // wait for a second digitalWrite(port, pin, LOW); // turn the LED off by making the voltage LOW __delay_cycles(50000); // wait for a second } int main(void) { init(); setup(); while(1) loop(); } Comments are encouraged! is this useful/useless, redundant, confusing, inaccurate, inconsistent, awesome/irrelevant, helpful, etc? thank you, Scott
  4. usbutil: unable to find a device matching 0451:f432

    Thanks, good info. I didn't know that about the updates.
  5. Hello

    Hi all, I just wanted to add a couple comments as a newbie. 1. Is there a "netiquette" for indicating that an issue is resolved? 2. I came to 430h because (as I recall) I was referred here by e2e. So now it's forever ingrained in my head that "oh, 430h is the Enegia form". But then I read in a post that users are worried that 430h is just going to be seen as an Energia. So I'm glad that's it's more than just for Energia. It also seems to be a bit more soft around the edges/friendlier than e2e. 3. For pedagogical purposes, I would like to use Energia projects in CCS. The problem is there are too many include files. On one end of the spectrum are very small code examples in CCS and on the other end of the spectrum are highly developed code in the Energia examples. So I would like something in between, a simplified/flattened (less hierarchy) version of some of the examples. I've created one for LiquidCrystal but it took me a day. And that was probably an easy one. Does anyone have a suggestion? thank you and sorry for the rant!
  6. Hello

    Perfect! thank you!
  7. usbutil: unable to find a device matching 0451:f432

    Let me know if you have a problem with the above steps.
  8. usbutil: unable to find a device matching 0451:f432

    I solved the problem by following these steps exactly: copy <energia directory>\hardware\tools\DSLite\DebugServer\drivers\MSP430.dll to <energia directory>\hardware\tools\msp430\bin\ edit <energia directory>\hardware\energia\msp430\boards.txt an change the 2 occurrences of rf2500 with tilib restart energia and you should be able to upload to the MSP-EXP430G2 with MSP430G2553. Apparently this is a known issue but there's some question about whether it's resolved using latest versions of the tool. The issue is also posted on github: https://github.com/energia/msp430-lg-core/issues/12
  9. usbutil: unable to find a device matching 0451:f432

    Hi, I had the exact same problem. I fixed it by editing a file according to: github.com/.../Common-error-messagese2e.ti.com/.../539487 This is posted on the TI forum here: https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/580238?tisearch=e2e-sitesearch&keymatch=energia usbutil%3A unable to find a device matching 0451%3Af432 Or you can search the TI forum using: "energia usbutil: unable to find a device matching 0451:f432"
  10. Energia Source Code

    Thank you both for the info! I don't see a "this solved my problem" check box so I'll just say thank you.
  11. Hello

    Hi all, I'm new to Energia but have been using CCS for about five years. Is there a way to run Energia code in CCS? Is the best way to copy all the source files into CCS? thank you!
  12. Energia Source Code

    Hi all, Where can I find source code for the Energia libraries? In particular, I'm looking for the source code for digitalWrite() and digitalRead(). thank you.
  13. Problems with Energia on MSP430 LaunchPad

    I'm having the same issue: usbutil: unable to find a device matching 0451:f432 Has anyone found a solution?