Jump to content

StefanWxx

Members
  • Content Count

    34
  • Joined

  • Last visited


Reputation Activity

  1. Like
    StefanWxx reacted to spirilis in Simple LPM4 serial demo ... does not work   
    Looks about right, though, please use the "volatile" keyword when declaring your "test" variable up above since it gets modified by an ISR.
     
    volatile int test;
  2. Like
    StefanWxx reacted to Rickta59 in Is this 38KHz PWM ?   
    yes
  3. Like
    StefanWxx reacted to pabigot in Is this 38KHz PWM ?   
    Well, maybe. One thing: fix the comment to note that TASSEL_2 means you're actually using SMCLK (nominally 1.1 MHz) instead of ACLK (nominally 12 kHz on that MCU with that initialization sequence).
     
    At 1.1MHz I think you'd get 42.3 kHz with 26 ticks per cycle. Since DCO tolerance on the MSP430G2553 is +/- 6% it's probably not very close to 38 kHz.
  4. Like
    StefanWxx reacted to oPossum in Is this 38KHz PWM ?   
    It's close. Can be made more accurate...
     
    Set the oscillator to one of the calibrated values.

    DCOCTL = 0; BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; Set the max count to N - 1
    TA0CCR0 = (1000000 / 38000) - 1; TA0CCR1 = TA0CCR0 >> 1;
  5. Like
    StefanWxx reacted to Rickta59 in Is this 38KHz PWM ?   
    I agree with all of the above. However do you really have to be that accurate for IR?
     
    My default clock seems to be 1.012MHz .. so it was 38.0something kHz when I measured it. Of course your results will vary. But for talking talk IR it should be fine.
  6. Like
    StefanWxx reacted to RobG in Is this 38KHz PWM ?   
    Here's another way
    DCOCTL |= DCO0 + DCO1; // DCO = ~300kHz BCSCTL1 |= RSEL0 + RSEL1; BCSCTL1 &= ~(RSEL2 + RSEL3); BCSCTL2 |= DIVS0 + DIVS1; // divide SMCLK by 8 which will give ~38kHz P1DIR |= BIT4; // port 1.4 is configured as SMCLK out and connected to IR emitter, this will be our carrier frequency, 38kHz P1OUT &= ~BIT4; P1SEL &= ~BIT4; // switch carrier off
  7. Like
    StefanWxx reacted to spirilis in Simple LPM4 serial demo ... does not work   
    Energia does work nicely with LPM modes.
     
    Use the newly minted (as of Energia 13) suspend(), sleep(), sleepSeconds() and wakeup() (latter can be run inside the interrupt routine) calls to perform your sleep operations.
     
    suspend() in particular performs LPM4.  Millis should not increment during this time.
     
    Also, I highly recommend issuing "Serial.flush()" before running any of the sleep/suspend calls.  Moreover, serial data won't really work correctly inside an ISR, so don't depend on it; structure your sketch so your loop() performs all serial calls and your ISR just issues wakeup().
  8. Like
    StefanWxx reacted to roadrunner84 in Simple LPM4 serial demo ... does not work   
    Energia doesn't work that nicely with low power modes.
    Serial.println does not actually print the line to the serial interface, it prints it to a buffer that is written to the interface after an iteration of loop is done.
    If you really want to do LPM4, don't use Energia (for now), it won't play nice with you. Rather write a plain program in CCS/GCC.
    Also, to keep your pipelines clear, it is recommended that you always do a nop after entering LPM. I think thee is this intrinsic called __no_operation().
  9. Like
    StefanWxx reacted to roadrunner84 in Serial.println(String) prints empty line   
    Serial handling is done in a separate routine, you're actually printing to a buffer that is scooped empty in between loop() calls (and between setup() and loop()).
    As a result you enable your btSerial before actual transmission of serial data is done.
    I do agree it's odd that serial and software serial do not work together...
    Why do you disable btSerial while in your processCommand()?
  10. Like
    StefanWxx reacted to oPossum in strtok_r Problem   
    char *p = text; char *q; char *str; while ((str = strtok_r(p, ",", &q)) != NULL) // delimiter is comma { p = NULL; Serial.println(str); delay(500); }
  11. Like
    StefanWxx reacted to yosh in How to parse string like "FF33BB" to 3 bytes ? ..for LEDStripe   
    @@StefanWxx Something like:
    for(int i=0;i<6;i++) {     leds0[i*3 + 0] = (a >> 16) & 0xFF;     leds0[i*3 + 1] = (a >> 8) & 0xFF;     leds0[i*3 + 2] = a & 0xFF; }
  12. Like
    StefanWxx reacted to roadrunner84 in How to parse string like "FF33BB" to 3 bytes ? ..for LEDStripe   
    #include <cstdlib>
     
    const char* s = "ff33bb";
    unsigned long a = strtoul (s, NULL, 16);
    // a is equal to 0xff33bb is equal to 996283
     
    // to break the 32-bit integer into three separate 8-bit integers
    unsigned char b[3];
    b[0] = (a >> 16) & 0xFF;
    b[1] = (a >> 8) & 0xFF;
    b[2] = a & 0xFF;
    // b[0] is equal to 0xff is equal to 255
    // b[1] is equal to 0x33 is equal to 51
    // b[2] is equal to 0xbb is equal to 187

     
  13. Like
    StefanWxx reacted to SixSixSevenSeven in How to wake up on keypad press ? [IR-Remote Project]   
    The keypad is a switch matrix.

     
    Yeah thats an arduino not an MSP430, but the circuit still works the same way. Label the top row as buttons 1 to 3, second to 4 to 6 etc. The Keypad library when you call getKey will turn pin 5 on to power the top row of buttons, it will then read pins 7, 8 and 9 to see if button 1, 2 or 3 is being pressed, then it will turn pin 5 off and pin 4 on, then read pins 7, 8 and 9 to see if buttons 4, 5 or 6 are being pressed, then it turns pin 4 off and pin 3 off to check buttons 7, 8 and 9 and finally 3 off and 2 on to check buttons 10, 11 and 12. When the keypad is not in use then none of the buttons will be powered and so there will be no interrupt signal to the MSP430.
     
    I've just checked the source for the Keypad library, it uses the row pins as input pullups and the column pins as outputs. If you manually set all the column pins high before entering sleep mode then you should be able to pick up the falling edge interrupts on the row pins to wake the MSP430 (at which point you should manually set all the column pins low again before letting the library take over)
  14. Like
    StefanWxx reacted to Thorvard in How to wake up on keypad press ? [IR-Remote Project]   
    I think when you go to sleep mode all outputs go tri-state, therefore there is no ground connected to the switches and when you push a button nothing happens. Try connecting an external pulldown resistor to the output-pins, 10k should work.
  15. Like
    StefanWxx reacted to olivluca in Sending Samsung TV RAW IR-codes   
    @@StefanWxx, I see that you had to reduce the mark/space timing by 10-15% wrt the timings in the arduino posts. This is consistent to what I had to do to get the NEC protocol working. I also have a (probably not 100% correct) solution for the led remaining on.
    See http://forum.43oh.com/topic/5396-irremote-library-sometimes-leaves-led-on/ for details.
     
    Edit: BTW, from the look of it, I'd say that samsung too is using the NEC protocol, so probably there is no need to add a separate sendSamsung function.
  16. Like
    StefanWxx reacted to olivluca in IRremote library sometimes leaves led on   
    I modified the library with the attached patch, now the led doesn't stay on anymore but I cannot control my TV set (lirc, which probably is more tolerant with the timing, recognizes the codes).
     
    Edit: I'm not permitted to attach this kind of file, inlined here
    --- IRremoteInt.h.orig 2014-04-21 10:29:43.489878975 +0200 +++ IRremoteInt.h 2014-04-21 11:33:19.417113888 +0200 @@ -142,15 +142,16 @@ // P2SEL |= BIT3; // P2.3 option select #define TIMER_PIN_SELECT() ({ \ P2DIR |= BIT3; \ - P2SEL |= BIT3; \ + P2SEL &= ~BIT3; \ + P2OUT &= ~BIT3; \ }) // defines for Timer_A (16 bits) // NOTE: Using A1 instead of A0 because A0 is used by Serial #if defined(IR_USE_TIMERA) #define TIMER_RESET -#define TIMER_ENABLE_PWM (TA1CTL = TASSEL_2 + MC_1) // SMCLK, Up mode -#define TIMER_DISABLE_PWM (TA1CTL = TASSEL_2 + MC_0) // SMCLK, Stop mode +#define TIMER_ENABLE_PWM ({TA1CTL = TASSEL_2 + MC_1; P2SEL |= BIT3;}) // SMCLK, Up mode +#define TIMER_DISABLE_PWM ({TA1CTL = TASSEL_2 + MC_0; P2SEL &= ~BIT3; P2OUT &= ~BIT3;}) // SMCLK, Stop mode #define TIMER_ENABLE_INTR ({ /*TA1CTL |= TAIE;*/ TA1CCTL0 |= CCIE;}) // SH 071112 #define TIMER_DISABLE_INTR ({TA1CTL &= ~TAIE; TA1CCTL0 &= ~CCIE;}) #define TIMER_INTR_NAME TIMER1_A0_VECTOR --- IRremote.cpp.orig 2014-04-21 11:36:07.333117889 +0200 +++ IRremote.cpp 2014-04-21 11:29:03.862107798 +0200 @@ -215,8 +215,8 @@ TIMER_PIN_SELECT(); // P2.3 output and P2.3 option select (when TIMER_PWM_PIN is P2_3) - pinMode(TIMER_PWM_PIN, OUTPUT); - digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low + //pinMode(TIMER_PWM_PIN, OUTPUT); + //digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low // TODO: update the comments below
  17. Like
    StefanWxx got a reaction from bluehash in Sending Samsung TV RAW IR-codes   
    after 3 days of breeding,
    the egg is layed!
     
    use this pulse parameters
    #define SAMSUNG_BITS 32 #define SAMSUNG_HDR_MARK 4500 #define SAMSUNG_HDR_SPACE 4250 #define SAMSUNG_BIT_MARK 600 #define SAMSUNG_ONE_SPACE 1400 #define SAMSUNG_ZERO_SPACE 450 now it works, easter may come 
  18. Like
    StefanWxx got a reaction from bluehash in [Energia Library] SYMA S026G Helicopter LaunchPad MSP430G2xxx   
    Hi, 
     
    No, I wanted not send data over the serial port, but this is certainly possible but i cannot exclude timing problems of which I know nothing at the moment.
     
    I want to control directly a L298N Dual H Bridge DC Stepper Motor Drive Board.
    With the remote i want to drive a toy car, little project for my son and learning purposes.
×
×
  • Create New...