Jump to content

guybarash

Members
  • Content Count

    19
  • Joined

  • Last visited

  1. guybarash

    launchpad msp430f5529 5v external power supply

    i have the Rev 1.4 . the usb power supply is not such an issue for me, but the external power supply using the pins is. if i connect a 3v3 + GND to the 3v3 network my device works just fine , but if i supply 5v directly to the 5v pin - nothing happens, the dc-dc doesn't either gets power (which is odd, there is power in the 5v jumper) , or it does get power but doesn't convert (the 3v3 jumper isn't getting power). if i could either connect the device directly to a 5v or insert a 5v supply through USB both will be Okay (preferably directly to the pins). does that require soldering as well?
  2. guybarash

    launchpad msp430f5529 5v external power supply

    when connecting to charger the 5v and the 3v shows nothing (not exactly 0 , around 30 miliVolt). but the ground pins are excatly 0. i have 2 launchped (same module) . both show same result.
  3. hi, i'm a proud owner of a launchpad Msp430F5529, and i'm trying to power it up with an external 5v power supply. if i connect the device to my computer - it works. i connect the 5v network it doesn't work. i connect the 3v3 network to a 3v3 power supply - it works. i connect the launchpad to a galaxy cell-phone charger - still , no work. the 5v , 3v3 ang GND jumpers are connected. when i connect the 5v power supply i measured the voltage on the 3v3 jumper - nothing there. i assume the computer is activating the dc-dc convertor which is not powered when no computer connection exits , if thats the case , how can i work it to work ? if i'm wrong, what is the problem? thank you
  4. guybarash

    pwn reading drops and grows back

    really? no one?
  5. guybarash

    pwn reading drops and grows back

    hi, im using the msp430F5529 LP with code composer, 16 maxbotix sonars, and 2 mux, i want to be able to read each one on the damand. the code segment: volatile uint32_t upd1 = 0; // Ultrasonic Pulse Duration (500 ns resolution) volatile uint32_t upd2 = 0; // Ultrasonic Pulse Duration (500 ns resolution) //sensor functions uint32_t ReadSensor4(int num); // Reading from port 2.5 uint32_t ReadSensor5(int num); // Reading from port 2.5 int ChangeSensor(int num); // choose sensor config void initSonar () { P2DIR &= ~(BIT4+BIT5) ; // Comparison is done on port 2.4 P2SEL |= BIT4 + BIT5 ; // function in 2.4 is used TA2CTL = TASSEL_2 | MC_2 | ID_3 | TACLR | TAIE; TA2CCTL0 = OUTMOD_4; // Toggle mode TA2CCTL1 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt TA2CCTL2 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt TA2CCTL1 &= ~CCIE; TA2CCTL2 &= ~CCIE; P4DIR |= BIT0; //pins controlling the mux P3DIR |= BIT7; P8DIR |= BIT2; ChangeSensor(0); return; } int ChangeSensor(int num) { switch(num) { // Msb: 4.0 3.7 8.2 LSB case 0: { P4OUT &= ~BIT0; P3OUT &= ~BIT7; P8OUT &= ~BIT2; break; } case 1: { P4OUT &= ~BIT0; P3OUT &= ~BIT7; P8OUT |= BIT2; break; } case 2: { P4OUT &= ~BIT0; P3OUT |= BIT7; P8OUT &= ~BIT2; break; } case 3: { P4OUT &= ~BIT0; P3OUT |= BIT7; P8OUT |= BIT2; break; } case 4: { P4OUT |= BIT0; P3OUT &= ~BIT7; P8OUT &= ~BIT2; break; } case 5: { P4OUT |= BIT0; P3OUT &= ~BIT7; P8OUT |= BIT2; break; } case 6: { P4OUT |= BIT0; P3OUT |= BIT7; P8OUT &= ~BIT2; break; } case 7: { P4OUT |= BIT0; P3OUT |= BIT7; P8OUT |= BIT2; break; } } return num; } uint32_t ReadSensor4(int num) { if (num > 7) {return 0;} ChangeSensor(num); upd1 = 0; TA2CCTL1 |= CCIE; MsecDelay(1); while (upd1 == 0); TA2CCTL1 &= ~CCIE; return ((upd1 * 20) / 147); } uint32_t ReadSensor5(int num) { if (num > 7) {return 0;} ChangeSensor(num); upd2 = 0; TA2CCTL2 |= CCIE; MsecDelay(1); while (upd2 == 0); TA2CCTL2 &= ~CCIE; return ((upd2 * 20) / 147); } uint32_t ReadSensor(int num) { if (num < 0 ) { return 0;} if (num < 8 ) { return ReadSensor4(num);} if (num < 16) { return ReadSensor5((num - 8));} return 0; } // the two sonar sensors . port 2.4(upd1) and 2.5(upd2) static volatile uint32_t rise1 = 0; // Pulse rise time from port 2.4 static volatile uint32_t fall1 = 0; // Pulse fall time from port 2.4 static volatile uint32_t rise2 = 0; // Pulse rise time from port 2.5 static volatile uint32_t fall2 = 0 ; // Pulse fall time from port 2.5 #pragma vector = TIMER2_A1_VECTOR // Timer vectored interrupt __interrupt void timer2_a2_isr_SONAR(void) // { // // switch(TA2IV) { // TA2IV must be read to reset interrupt case 0:break; // Vector 0 - no interrupt case 0x02: // 0x02 == CCR1 (capture/compare) if(TA2CCTL1 & CCI) { // - Rising edge rise1 = TA2CCR1; // Save rise time fall1 = 0; // Reset fall time } else { // - Falling edge if(rise1) { // Make sure rising edge has occurred // Handle possible pending overflow interrupt if((TA2CTL & TAIFG) && (TA2R < 0x1000)) { fall1 += 0xffff; fall2 += 0xffff; } fall1 += TA2CCR1; // Get fall time, add to overflow time if(!upd1) {upd1 = fall1 - rise1;} // Update time if mainline code is ready for it rise1 = 0; // Clear rise time to ensure next rising edge is used } // } // break; // case 0x04: //// 0x04 == CCR2 (capture/compare) if(TA2CCTL2 & CCI) { // - Rising edge rise2 = TA2CCR2; // Save rise time fall2 = 0; // Reset fall time } else { // - Falling edge if(rise2) { // Make sure rising edge has occurred // Handle possible pending overflow interrupt if((TA2CTL & TAIFG) && (TA2R < 0x1000)) { fall1 += TA2CCR0; fall2 += TA2CCR0; } fall2 += TA2CCR2; // Get fall time, add to overflow time if(!upd2) {upd2 = fall2 - rise2;} // Update time if mainline code is ready for it rise2 = 0; // Clear rise time to ensure next rising edge is used } // } // break; case 0x0E: // 0x0E == TAIFG (overflow) fall1 += 0xffff; // Update overflow time fall2 += 0xffff; break; // } // } // is based on a code given here to me before. 0-7 is mux 2.4 8-15 is mux 2.5 if i read from mux 0 and 9 everthing is OK . but if i read from the same mux , lets say 0 and then 1 repeatedly , every once in a while there is a drop. e.g , lets say the distances are 100 and 50 , the reading will look something like this: 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 0 20 50 70 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 0 10 40 90 100 100 100 .... my guess is it's somthing to do with the ovf, it was 0x0A at first but it never reached it, now it does, but the broblem remains... pls help...
  6. guybarash

    PWM with spedific period

    i'm using the ccs. thx! I'm still learning the device , can you explain the key steps please?
  7. guybarash

    PWM with spedific period

    hi , i'm trying to create a PWM signal with period of 15 msec and pulse width the can vary between 1.1 msec and 1.9 msec. (I'm using the Msp430F5529 ) how can i do it? thx in advance.
  8. guybarash

    PWM input

    ok, i've got it running with a few modification in order to meet my specifics . but every once in while i'm getting jibbrish instead of a number(ASCII jibrrish), i've attached the printscreen and the code, you maybe know where is the failure? #include <msp430.h> #include <stdint.h> #include <stdlib.h> //global variables volatile char vmsg[81]; //the gps str volatile unsigned int vi = 0; // counter for the interrupt volatile int vvalid = 0; // vmsg is valid iff vvalid =1 volatile uint32_t upd = 0; // Ultrasonic Pulse Duration (500 ns resolution) //UART functions void initUART1() ; // init UART1 (to PC) void initUART2() ; // init UART2 (from gps) void putc(volatile char c); //send a single char void puts(volatile char *s); //send a string char getc(); //Receive single char void print_int(int n); // Print integer void print_u32(uint32_t n, const unsigned dp) ; // print U32 //sensor functions void initcmprTimerA (); //init timer A comparison int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT initUART1(); initUART2(); initcmprTimerA (); __bis_SR_register(GIE); //interrupts enabled // Setup puts("\r\nStart here: \r\n"); upd =0; // end of setup while(1){ // Endless Loop start puts("reading: "); while (upd == 0); //wait reading print_u32(upd,0); upd = 0; // signal "ready" puts("\r\n"); // Endless Loop ending } } void initcmprTimerA () { P2DIR &= ~BIT4 ; // Comparison is done on port 2.4 P2SEL |= BIT4 ; // function in 2.4 is used TA2CTL = TASSEL_2 | MC_2 | ID_3 | TACLR | TAIE; TA2CCTL0 = OUTMOD_4; // Toggle mode TA2CCTL1 = CM_3 | SCS | CAP | CCIE; // Rising and falling, sync, capture, interrupt TA2CCTL2 |= 0; // not in use } void initUART1(){ P4SEL |= BIT4 + BIT5; UCA1CTL1 |= UCSWRST; // **Put state machine in reset** UCA1CTL1 |= UCSSEL_2; // SMCLK UCA1BR0 = 6; // 1MHz 9600 UCA1BR1 = 0; // 1MHz 9600 UCA1MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0, UCA1IE |= UCRXIE; // over sampling UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine** } void initUART2() { P3SEL = BIT3+BIT4; UCA0CTL1 |= UCSWRST; // **Put state machine in reset** UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 6; // 1MHz 9600 UCA0BR1 = 0; // 1MHz 9600 UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0, // over sampling UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt } void putc(char c) { while (!(UCA1IFG & UCTXIFG)); UCA1TXBUF = c; } void puts(volatile char *s) { while(*s) putc(*s++); } char getc() { //Receive char while (!(UCA1IFG & UCRXIFG)); return UCA1RXBUF; } void print_int(int n) // Print integer { int msbflag = 1; // changing msbflag setup to 0 disables '0' in msb, '1' o.w . example for values of msb flag: '1' : +000123 '0': 123 if (n < 0 ) { putc('-'); n = 0 - n; } else {putc('+'); } if ((n == 0 ) && (msbflag == 0) ) { putc('0'); return; } unsigned c; // c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; if( (c!= '0') || (msbflag > 0) ) {msbflag++; putc(c);} // c = '0'; while(n >= 10000) n -= 10000, ++c; if( (c!= '0') || (msbflag > 0) ) {msbflag++; putc(c);} // c = '0'; while(n >= 1000) n -= 1000, ++c; if( (c!= '0') || (msbflag > 0) ) {msbflag++; putc(c);} // c = '0'; while(n >= 100) n -= 100, ++c; if( (c!= '0') || (msbflag > 0) ) {msbflag++; putc(c);} // c = '0'; while(n >= 10) n -= 10, ++c; if( (c!= '0') || (msbflag > 0) ) {msbflag++; putc(c);} // c = '0'; while(n) --n, ++c; if( (c!= '0') || (msbflag > 0) ) {msbflag++; putc(c);} // return; } void print_u32(uint32_t n, const unsigned dp) // Print 32 bit unsigned with optional decimal place // 6 decimal digits (0 -> 999999) { // unsigned c; // c = '0'; while(n >= 100000UL) n -= 100000UL, ++c; putc(c); if(dp == 5) putc('.'); // c = '0'; while(n >= 10000) n -= 10000, ++c; putc(c); if(dp == 4) putc('.'); // c = '0'; while(n >= 1000) n -= 1000, ++c; putc(c); if(dp == 3) putc('.'); // c = '0'; while(n >= 100) n -= 100, ++c; putc(c); if(dp == 2) putc('.'); // c = '0'; while(n >= 10) n -= 10, ++c; putc(c); // if(dp == 1) putc('.'); // c = '0'; while(n) --n, ++c; putc(c); // } // interrupts #pragma vector=USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) { switch(__even_in_range(UCA0IV,4)) { case 0:break; // Vector 0 - no interrupt case 2: // Vector 2 - RXIFG vvalid = 0; vmsg[vi] = UCA0RXBUF; vi++; if ((vmsg[vi-1] == 10) && (vmsg[vi-2] == 13)) { //end of msg vmsg[vi] = '\0'; vi = 0; vvalid = 1; } /* while (!(UCA1IFG&UCTXIFG)); // USCI_A0 TX buffer ready? UCA1TXBUF = UCA0RXBUF; // TX -> RXed character */ break; case 4:break; // Vector 4 - TXIFG default: break; } } #pragma vector = TIMER2_A1_VECTOR // Timer vectored interrupt __interrupt void timer2_a2_isr(void) // { // static uint32_t rise = 0; // Pulse rise time static uint32_t fall; // Pulse fall time // switch(TA2IV) { // TA0IV must be read to reset interrupt case 0:break; // Vector 0 - no interrupt case 0x02: // 0x02 == CCR1 (capture/compare) if(TA2CCTL1 & CCI) { // - Rising edge rise = TA2CCR1; // Save rise time fall = 0; // Reset fall time } else { // - Falling edge if(rise) { // Make sure rising edge has occurred // Handle possible pending overflow interrupt if((TA2CTL & TAIFG) && (TA2R < 0x1000)) fall += TA2CCR0; // fall += TA2CCR1; // Get fall time, add to overflow time if(!upd) {upd = fall - rise;} // Update time if mainline code is ready for it rise = 0; // Clear rise time to ensure next rising edge is used } // } // break; // case 0x0A: // 0x0A == TAIFG (overflow) fall += TA2CCR0; // Update overflow time break; // } // } // of course, any other comments about the code a re very welcome.
  9. guybarash

    PWM input

    hi , I've switched to the MSP430-F5529 and i'm trying to measure a PWM, and i'm having a bit of hard time understanding the registers use, i want to use timer TA2 which has (according to the datasheet) : P2.3/TA2.0 P2.4/TA2.1 P2.5/TA2.2 as i'm getting input i'm guessing that p2dir = 0; what is the p2sel should be? TA1CCR0 ? TA1CCTL0? TA1CCTL1? TA1CTL? and can i have a bit of an explanation about these register function? and to which of these pins shpuld the pwm be connected to? thank you.
  10. guybarash

    connecting GPS and PC via UART serial comm.

    that actually is a great idea , could you please elaborate a bit on how can i do it (meaning in hardware) , which jumper do i leave where?
  11. guybarash

    connecting GPS and PC via UART serial comm.

    Ok , i had a technical problem , the gps is sending data correctly . but i don't know how to maintain two separate UART comm at the same time. can it be done? (on the msp430G2553 anyway) i'm using the USB UART with the jumpers set to HW. can i keep getting info from the gps while i do it?
  12. guybarash

    connecting GPS and PC via UART serial comm.

    using the Code Composer Studio 5.3.0
  13. guybarash

    connecting GPS and PC via UART serial comm.

    hi , i'm not using the Energia , and i'm having a bit of a hard time utilizing that information. also, i'm using the launchpad and not directly to the PC because it's a part of a larger project that will need to process the information and other sensors. i need to extract the coordinates and what additional data i can for both the device i'm building itself and then to the PC for further analysis. the information to the PC is enough to simply present it on the terminal (i'm using the PUTTY on serial comm mode) can i use only the TX of the GPS module? if not what do i have to send in order to "jump-start" the gps? I know this information should be in the module datasheet but i just couldn't find that in it, maybe i'm missing something(as you guessed i'm a bit of noob as my forum class indicates :-) ) thx to whom ever helps
  14. guybarash

    connecting GPS and PC via UART serial comm.

    I'm trying to make a code that is recieve coordinates from the GPS reciever (gp 635T) to the launchpad and via UART to the PC Any help will be vastly appreciated
  15. hi, i'm using the launchpad msp430G2553 and a GP-635T GPS. the GPS connects via UART serial connection but so is the PC connection, how can i read from the GPS and send to the PC? i've set the jumpers so the UART is transmitted through the built-in usb, should i change it? thx in advance
×