Jump to content
43oh

roadrunner84

Members
  • Content Count

    1,370
  • Joined

  • Last visited

  • Days Won

    33

Reputation Activity

  1. Like
    roadrunner84 got a reaction from energia in String object strange behaviour   
    Because String does use dynamic memory, which your MSP430 does barely handle. Either declare your string with a decent size, or use plain c-strings.
    String st(100, '\0'); or
    char st[100] = "";
  2. Like
    roadrunner84 reacted to Mark Easley TI in Hackster Live   
    Did anyone see the Hackster Live annoucement? They are recruiting ambassadors to host hardware meetups worldwide. If being a local community leader sounds interesting you should consider applying.
     
    https://www.hackster.io/live
     
     
    Also post and share your 43oh projects on Hackster, it is a great platform to get eyes on your work!
     
    https://www.hackster.io/ti-launchpad/
     
  3. Like
    roadrunner84 reacted to spirilis in Ultra Low Power   
    for the G2553, even the 20-pin versions, don't forget about P3... set P3SEL and P3SEL2 to 0 and P3DIR to 0xFF, P3OUT to 0.  It's not connected to any of the external pins but the port is there--and might cause some power consumption if left floating as inputs.
     
    The 28-pin TSSOP package of the G2553 has the P3 pins exposed (and probably the QFN variant).
  4. Like
    roadrunner84 reacted to RobG in How to protect your free code from companies predating on it ?   
    There's no way you can stop it, you can only make it difficult. I have seen people taking my code (or parts of it) and then claiming it as theirs. Even my board designs were "borrowed." If my code is simple and not unique, I don't mind when other's are using it. If I spend many hours writing the code, reading data sheets, and researching, that's another story.
     
    Oh, and if you don't like when companies steal software, then you should stop using Android  
  5. Like
    roadrunner84 got a reaction from bluehash in Convert IPAddress to Byte Array   
    According to this the IPAddress class contains a private member called _address, which is a 4 byte array. The private method raw_address() will return a pointer to it.
    The uint32_t cast operator will return a uint32_t value of the address. The index operator [] will return the value or a reference to the byte elements.
    As a result, you can treat the IPAddress class as 4 byte array, but you cannot treat it as a pointer.
    // Good code for (int iter = 0; iter < 4; ++iter) { uint8_t arr[4]; // do something withe ip[iter] arr[iter] = ip[iter]; ip[iter] = 0; } // Bad code uint8_t *ip_bytes = &ip[0];
  6. Like
    roadrunner84 got a reaction from SBarth in Convert IPAddress to Byte Array   
    According to this the IPAddress class contains a private member called _address, which is a 4 byte array. The private method raw_address() will return a pointer to it.
    The uint32_t cast operator will return a uint32_t value of the address. The index operator [] will return the value or a reference to the byte elements.
    As a result, you can treat the IPAddress class as 4 byte array, but you cannot treat it as a pointer.
    // Good code for (int iter = 0; iter < 4; ++iter) { uint8_t arr[4]; // do something withe ip[iter] arr[iter] = ip[iter]; ip[iter] = 0; } // Bad code uint8_t *ip_bytes = &ip[0];
  7. Like
    roadrunner84 got a reaction from energia in Convert IPAddress to Byte Array   
    According to this the IPAddress class contains a private member called _address, which is a 4 byte array. The private method raw_address() will return a pointer to it.
    The uint32_t cast operator will return a uint32_t value of the address. The index operator [] will return the value or a reference to the byte elements.
    As a result, you can treat the IPAddress class as 4 byte array, but you cannot treat it as a pointer.
    // Good code for (int iter = 0; iter < 4; ++iter) { uint8_t arr[4]; // do something withe ip[iter] arr[iter] = ip[iter]; ip[iter] = 0; } // Bad code uint8_t *ip_bytes = &ip[0];
  8. Like
    roadrunner84 got a reaction from L.R.A in Atmel bought by Microchip   
    So I read today that Microchip (those who make the PIC MCU) bought Atmel (those who make the ATmega MCU, used on the Arduino boards).
    They paid $3.6 billion (ss) to acquire the company.
    What will this mean for the Arduino companies (yes, there's two of them, and they do not like each other) and their maker supporter base? An ideal opportunity for TI to step in with their Launchpads!
  9. Like
    roadrunner84 got a reaction from spirilis in Atmel bought by Microchip   
    So I read today that Microchip (those who make the PIC MCU) bought Atmel (those who make the ATmega MCU, used on the Arduino boards).
    They paid $3.6 billion (ss) to acquire the company.
    What will this mean for the Arduino companies (yes, there's two of them, and they do not like each other) and their maker supporter base? An ideal opportunity for TI to step in with their Launchpads!
  10. Like
    roadrunner84 got a reaction from abecedarian in Redundant Microcontroller Programming   
    I once did a medical grade project, the designer chose to have very extensive redundancy.
    - Three different brand micro controllers were used
    - Code was written non-shared
    - Every task was handled by two controllers redundantly
    All of this to avoid silicon bugs, programming bugs, quality issues, etc.
     
    If you want to have a "spare" kind of redundancy - one fails, other takes over, replace first while online - you should still use an additional arbitrating control. Depending on where you can still afford redundancy.
    If you have a certain indicator LED that is vital for your function, consider putting in two LEDs; one to each controller.
    If you have some kind of actuator (e.g.: motor), have some majority voting in place. Or consider using open-drain control, so if either controller fails, the other still drives the line.
  11. Like
    roadrunner84 got a reaction from energia in Redundant Microcontroller Programming   
    I once did a medical grade project, the designer chose to have very extensive redundancy.
    - Three different brand micro controllers were used
    - Code was written non-shared
    - Every task was handled by two controllers redundantly
    All of this to avoid silicon bugs, programming bugs, quality issues, etc.
     
    If you want to have a "spare" kind of redundancy - one fails, other takes over, replace first while online - you should still use an additional arbitrating control. Depending on where you can still afford redundancy.
    If you have a certain indicator LED that is vital for your function, consider putting in two LEDs; one to each controller.
    If you have some kind of actuator (e.g.: motor), have some majority voting in place. Or consider using open-drain control, so if either controller fails, the other still drives the line.
  12. Like
    roadrunner84 got a reaction from yosh in Redundant Microcontroller Programming   
    I once did a medical grade project, the designer chose to have very extensive redundancy.
    - Three different brand micro controllers were used
    - Code was written non-shared
    - Every task was handled by two controllers redundantly
    All of this to avoid silicon bugs, programming bugs, quality issues, etc.
     
    If you want to have a "spare" kind of redundancy - one fails, other takes over, replace first while online - you should still use an additional arbitrating control. Depending on where you can still afford redundancy.
    If you have a certain indicator LED that is vital for your function, consider putting in two LEDs; one to each controller.
    If you have some kind of actuator (e.g.: motor), have some majority voting in place. Or consider using open-drain control, so if either controller fails, the other still drives the line.
  13. Like
    roadrunner84 got a reaction from RahulS in Hi ,I am Rahul from Bangalore, India   
    Hi, welcome to the forums, hope we can help each other.
  14. Like
    roadrunner84 reacted to D12 in MSP430G2553 Interfacing w/ PS2 Controller   
    Nevermind, main problem was PS2 controllers send LSB first, so instead of sending 0x01, it needs to be sent 0x80.  Other then that minor code tweaks and it works fine.
  15. Like
    roadrunner84 got a reaction from bluehash in Products using MSP430   
    Do your hacker fingers tickle too?
  16. Like
    roadrunner84 got a reaction from yyrkoon in Raspberry PI Zero for $5   
    @@sq7bti Since SOS solutions is in Eindhoven as are you and I, it'd be no problem to pick it up, bit it's still
  17. Like
    roadrunner84 got a reaction from bluehash in Energia Serial Communication   
    And this is a readable version of your code:
    void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial1.begin(9600); } void loop() { // put your main code here, to run repeatedly: // put your setup code here, to run once: Serial1.println("AT"); while(Serial1.available()>0) { Serial.print((char)Serial1.read()); } delay(1000); Serial1.println("AT+CMGF=1"); while(Serial1.available()>0) { Serial.print((char)Serial1.read()); } delay(1000); /*Serial1.println("AT+CNMI=2,2,0,0"); delay(100); while(Serial1.available()>0) { Serial.print((char)Serial1.read()); }*/ } Tell us what you try to do, what you did, what you expected and what you did get as a result. Which things did you try to overcome, how?
    You could change your code to put both interfaces in loopback (echo) mode, then test them both with a terminal application. Or maybe even try to have both hooked up to terminal applications and feed in the supposed responses from the sim900 module, so you can test if your code is doing what you expect it to.
    after that, you can try communicating with the sim900 module directly, try to find if the behaviour is identical to what you expect.
    Lastly, in your commented out code you have a 100 ms delay, why did you not put it in the other two blocks? Maybe replace it with a while(Serial1.available() == 0); to have it wait for the sim900 to respond.
  18. Like
    roadrunner84 reacted to greeeg in Products using MSP430   
    Was reading this article about the new Macbook charger.
    http://www.righto.com/2015/11/macbook-charger-teardown-surprising.html
     
    Look what we have here!

     
    I'm not sure what it actually does, there is already a dedicated SMPS IC and a PFC IC.
    It might implement an intelligent over current cutoff?
  19. Like
    roadrunner84 got a reaction from greeeg in Interfacing a LCD (4-bit mode) to the MSP430g2553 in assembly   
    Why would you want to do it in assembly? You could of course just compile the C code and see what assembly code rolls out.
  20. Like
    roadrunner84 got a reaction from tripwire in Interfacing a LCD (4-bit mode) to the MSP430g2553 in assembly   
    Why would you want to do it in assembly? You could of course just compile the C code and see what assembly code rolls out.
  21. Like
    roadrunner84 got a reaction from Fmilburn in combining CCS and Energia codes   
    analogWrite() should set up the PWM output on a pin to run continuously, so it should work as @@Rei Vilo wrote.
    As I told, doing things with timers may throw off your Energia framework, and doing things with timers is exactly what your example does.
    The Energia call analogWrite() does roughly the same as your C code, but all while respecting the Energia framework.
    If you dig into the Energia install folder, you'll find the C code behind analogWrite() in it, this is what I found:
    #define PWM_PERIOD analog_period // F_CPU/490 #define PWM_DUTY(x) ( (unsigned long)x*PWM_PERIOD / (unsigned long)analog_res ) void analogWrite(uint8_t pin, int val) { pinMode(pin, OUTPUT); // pin as output if (val == 0) { digitalWrite(pin, LOW); // set pin to LOW when duty cycle is 0 // digitalWrite will take care of invalid pins } else if (val == analog_res) { digitalWrite(pin, HIGH); // set pin HIGH when duty cycle is 255 // digitalWrite will take care of invalid pins } else { uint8_t bit = digitalPinToBitMask(pin); // get pin bit uint8_t port = digitalPinToPort(pin); // get pin port volatile uint8_t *sel; if (port == NOT_A_PORT) return; // pin on timer? sel = portSelRegister(port); // get the port function select register address *sel |= bit; // set bit in pin function select register switch(digitalPinToTimer(pin)) { // which timer and CCR? //case: T0A0 // CCR0 used as period register case T0A1: // TimerA0 / CCR1 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL1 = OUTMOD_7; // reset/set TA0CCR1 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1 + analog_div; // SMCLK, up mode break; #if defined(__MSP430_HAS_TA3__) || defined(__MSP430_HAS_T0A3__) || defined(__MSP430_HAS_T0A5__) || defined(__MSP430_HAS_TA5__) case T0A2: // TimerA0 / CCR2 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL2 = OUTMOD_7; // reset/set TA0CCR2 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_TA5__) || defined(__MSP430_HAS_T0A5__) case T0A3: // TimerA0 / CCR3 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL3 = OUTMOD_7; // reset/set TA0CCR3 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T0A4: // TimerA0 / CCR4 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL4 = OUTMOD_7; // reset/set TA0CCR4 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_T1A3__) //case: T1A0 // CCR0 used as period register case T1A1: // TimerA1 / CCR1 TA1CCR0 = PWM_PERIOD; // PWM Period TA1CCTL1 = OUTMOD_7; // reset/set TA1CCR1 = PWM_DUTY(val); // PWM duty cycle TA1CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T1A2: // TimerA1 / CCR2 TA1CCR0 = PWM_PERIOD; // PWM Period TA1CCTL2 = OUTMOD_7; // reset/set TA1CCR2 = PWM_DUTY(val); // PWM duty cycle TA1CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_T2A3__) //case: T2A0 // CCR0 used as period register case T2A1: // TimerA2 / CCR1 TA2CCR0 = PWM_PERIOD; // PWM Period TA2CCTL1 = OUTMOD_7; // reset/set TA2CCR1 = PWM_DUTY(val); // PWM duty cycle TA2CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T2A2: // TimerA2 / CCR2 TA2CCR0 = PWM_PERIOD; // PWM Period TA2CCTL2 = OUTMOD_7; // reset/set TA2CCR2 = PWM_DUTY(val); // PWM duty cycle TA2CTL = TASSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_T0B3__) || defined(__MSP430_HAS_T0B7__) //case: T0B0 // CCR0 used as period register case T0B1: // TimerB0 / CCR1 TB0CCR0 = PWM_PERIOD; // PWM Period TB0CCTL1 = OUTMOD_7; // reset/set TB0CCR1 = PWM_DUTY(val); // PWM duty cycle TB0CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T0B2: // TimerB0 / CCR1 TB0CCR0 = PWM_PERIOD; // PWM Period TB0CCTL2 = OUTMOD_7; // reset/set TB0CCR2 = PWM_DUTY(val); // PWM duty cycle TB0CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_T0B7__) case T0B3: // TimerB0 / CCR3 TB0CCR0 = PWM_PERIOD; // PWM Period TB0CCTL3 = OUTMOD_7; // reset/set TB0CCR3 = PWM_DUTY(val); // PWM duty cycle TB0CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T0B4: // TimerB0 / CCR4 TB0CCR0 = PWM_PERIOD; // PWM Period TB0CCTL4 = OUTMOD_7; // reset/set TB0CCR4 = PWM_DUTY(val); // PWM duty cycle TB0CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T0B5: // TimerB0 / CCR5 TB0CCR0 = PWM_PERIOD; // PWM Period TB0CCTL5 = OUTMOD_7; // reset/set TB0CCR5 = PWM_DUTY(val); // PWM duty cycle TB0CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T0B6: // TimerB0 / CCR6 TB0CCR0 = PWM_PERIOD; // PWM Period TB0CCTL6 = OUTMOD_7; // reset/set TB0CCR6 = PWM_DUTY(val); // PWM duty cycle TB0CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_T1B3__) //case: T1B0 // CCR0 used as period register case T1B1: // TimerB0 / CCR1 TB1CCR0 = PWM_PERIOD; // PWM Period TB1CCTL1 = OUTMOD_7; // reset/set TB1CCR1 = PWM_DUTY(val); // PWM duty cycle TB1CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T1B2: // TimerB0 / CCR1 TB1CCR0 = PWM_PERIOD; // PWM Period TB1CCTL2 = OUTMOD_7; // reset/set TB1CCR2 = PWM_DUTY(val); // PWM duty cycle TB1CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif #if defined(__MSP430_HAS_T2B3__) //case: T1B0 // CCR0 used as period register case T2B1: // TimerB0 / CCR1 TB2CCR0 = PWM_PERIOD; // PWM Period TB2CCTL1 = OUTMOD_7; // reset/set TB2CCR1 = PWM_DUTY(val); // PWM duty cycle TB2CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; case T2B2: // TimerB0 / CCR1 TB2CCR0 = PWM_PERIOD; // PWM Period TB2CCTL2 = OUTMOD_7; // reset/set TB2CCR2 = PWM_DUTY(val); // PWM duty cycle TB2CTL = TBSSEL_2 + MC_1+ analog_div; // SMCLK, up mode break; #endif case NOT_ON_TIMER: // not on a timer output pin default: // or TxA0 pin if (val <= (analog_res >> 1)) { digitalWrite(pin, LOW); // } else { digitalWrite(pin, HIGH); } } } } A long block of code, but the core is this:
    uint8_t bit = digitalPinToBitMask(pin); // get pin bit uint8_t port = digitalPinToPort(pin); // get pin port volatile uint8_t *sel; if (port == NOT_A_PORT) return; // pin on timer? sel = portSelRegister(port); // get the port function select register address *sel |= bit; // set bit in pin function select register switch(digitalPinToTimer(pin)) { // which timer and CCR? //case: T0A0 // CCR0 used as period register case T0A1: // TimerA0 / CCR1 TA0CCR0 = PWM_PERIOD; // PWM Period TA0CCTL1 = OUTMOD_7; // reset/set TA0CCR1 = PWM_DUTY(val); // PWM duty cycle TA0CTL = TASSEL_2 + MC_1 + analog_div; // SMCLK, up mode break; Which breaks down into
    determine the port (1) and bit (2) for the given pin (4). verify that this pin has a timer output. set the sel bit for this pin write the period, mode and duty cycle for this timer set up the timer which is exactly what you're doing.
     
    Oh, by the way, this is found in [energia]/hardware/msp430/cores/msp430/wiring_analog.c
  22. Like
    roadrunner84 reacted to greeeg in ledClock - dual colour led matrix   
    Hey Guys,
     
    Exam times again, so I feel like I have a tonne of time for my projects.
    This is a project I started in February 2014. I found a very nice 8x8 dual colour LED display. I designed a PCB for them when I ordered them, instead of when I actually had them.

    I had built a PCB up with a G2542 8kb / 512b (Mem/RAM) but didn't manage to get it working.
     
    Over the last few weeks I got back into this project, and low and behold it did actually work!!

     
    I built up a new PCB because it was designed as a common cathode driver, but the displays were common anode.... (on the first board, I had bridged the common mosfets.)

    of course using 0402 parts. (this display need 64 of these O_O)

    back of PCB contains clock, half a DCDC stepup and a BMA222 accelerometer.

     
    Front & back


     
    Now I needed a case, this is my first project I decided to actually make use of a cheap chinesse laser cutter I now own.

     
    The piece with all the slits in it create a "living hinge" which creates a cool organic looking case. as opposed to a rectangle.

     
    I'm still working on improving code. Basic clock functionality is in.
     
    lastly I'll leave you with my dud designs. which while not very practical. are actually 100% useful. A failed design can teach you alot!

     
    I will be making this open source, I would like to make more in the future, which may involve buying more displays from china (if there is interest maybe even a group buy?? )
     
  23. Like
    roadrunner84 got a reaction from tripwire in Flash memory can be damaged by writes? (and related things)   
    If you're in need of big memory, then yes. But in most cases you'd need to log only a dozen or so entries, then using on-chip memory is much more interesting.
    Also, note it's 512 kilobits, so that's 64 kilobytes. Still quite a bit of space. If you really need a LOT of memory, you could also consider using an SD card instead. SD cards are essentially just serial flash, not so different from EEPROMs. If you ditch the FAT filesystem, you don't need that much code to use them at all!
  24. Like
    roadrunner84 got a reaction from ElTita in Flash memory can be damaged by writes? (and related things)   
    Most flash memory can only be written to 0 values in their bits, the erase cycle will set all bits to 1 again. So writing a byte, say 10101010 and then writing 01010101 will result in a byte read as 00000000. To avoid such behaviour, you should always erase between write cycles. Alternatively, always write 11111111 to any byte you do not want to touch.
    Also, as suggested before, try not to keep bookkeeping data in flash (like the end-of-array-pointer). Instead, make sure the default value after erasing is not a valid statement, as a result, you can determine the end of your array by iterating over it to check for this end value.
     
    @@hmjswt You could do that... but why? There is flash and EEPROM-emulating-flash in these chips. Replacing the microcontroller is probably cheaper these days than adding more components in case the EEPROM dies. As suggested before, using an FRAM part would be nice too, since there is no real difference between RAM and flash on those, it's non-volatile RAM.
  25. Like
    roadrunner84 got a reaction from tripwire in Flash memory can be damaged by writes? (and related things)   
    Most flash memory can only be written to 0 values in their bits, the erase cycle will set all bits to 1 again. So writing a byte, say 10101010 and then writing 01010101 will result in a byte read as 00000000. To avoid such behaviour, you should always erase between write cycles. Alternatively, always write 11111111 to any byte you do not want to touch.
    Also, as suggested before, try not to keep bookkeeping data in flash (like the end-of-array-pointer). Instead, make sure the default value after erasing is not a valid statement, as a result, you can determine the end of your array by iterating over it to check for this end value.
     
    @@hmjswt You could do that... but why? There is flash and EEPROM-emulating-flash in these chips. Replacing the microcontroller is probably cheaper these days than adding more components in case the EEPROM dies. As suggested before, using an FRAM part would be nice too, since there is no real difference between RAM and flash on those, it's non-volatile RAM.
×
×
  • Create New...