Jump to content
43oh

pillum

Members
  • Content Count

    37
  • Joined

  • Last visited

Posts posted by pillum

  1. Hello,

     

    I want to measure the time between the both edges of clock signal.

    The Purpose of the project is to build a shift light with the MSP430 and the TLC5940 LED driver.

    The RPM signal to the tachometer comes in a 12V HIGH/LOW signal and the higher the RPM is the higher the frequency of the signal is. Instead of using a frequency counter I measure the time the signal is on HIGH.

    Capturing the signal with the Open Logic Sniffer gave me a straight and continuous signal.

     

    2 MSP430s are used. One to generate the signal and the other to measure it.

     

    MSP430 #1 P1.0 -> MSP430 #2 P2.1

     

    This is the code for generating the clock:

    void main(void)
    {
    WDTCTL = WDTPW + WDTHOLD;
    
    DCOCTL = CALDCO_16MHZ;
    BCSCTL1 = CALBC1_16MHZ;
    
    P1DIR = BIT0;
    P1OUT = 0x00;
    
    TACTL = TASSEL_2 | MC_1 | ID_0;
    CCR0 = 8000;
    CCTL0 = CCIE;
    
    _enable_interrupts();
    
    _bis_SR_register(LPM0 | GIE);
    }
    
    #pragma vector=TIMER0_A0_VECTOR
    __interrupt void Timer_A (void)
    {
    P1OUT ^= BIT0;                            // Toggle P1.0
    }
    

     

    This is the code for measuring it:

    void main()
    {
       /* Clock Setup */
       WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    
       // Set Clock Frequency to 16Mhz
       BCSCTL1 = CALBC1_16MHZ;
       DCOCTL = CALDCO_16MHZ;
    
    P2SEL = BIT1;
    P1DIR = 0x00;
    
    TA1CTL = TASSEL_2 + MC_2;
    TA1CCTL1 = CM_3 | SCS | CCIS_0 | CAP | CCIE;
    _enable_interrupts();
    for(;
    	;
    }
    
    #pragma vector=TIMER1_A1_VECTOR
    __interrupt void TimerA1(void)
    {
    timer = TA1CCR1;
    TA1CTL |= TACLR;
    TA1CCTL1 &= ~(COV | CCIFG);
    }

    (I even tried to set the check to positive edge and in the ISR set the check to negative edge so its only measuring the HIGH signal time.)

     

    Sometimes I get values around CCR0 (8048, 8079, ..) but mostly its trash (0, 33152, 5000, 6915, ...).

     

    Whats wrong?

     

    Thank you

  2. Cr*p...happens again. This time everythings soldered so no flaky breadboard connection.

    Do I need to update DC register before updating GS register? Also, do I need the first cycle flag when not updating it?

     

    VPRG and DCPRG are grounded and not controlled by MSP this time since I'm using the DC data from EEPROM.

     

    Sniffer tells me, that there is a (clocked) current flowing through OUTn (strangely also on TLCs not connected to the MSP).

    But the LEDs are pretty dark to off using the same old resistor with value of 1.91kOhm

  3. Here is the implementation of what I was suggesting.

    Send byte through UART to light up the LED.

    Upper nibble controls LED #, lower nibble brightness (0-15)

    So, to set LED#1 to max, you send 0x1F, LED#16 to 50%, send 0xF7

    LED#4 '0' = 0%, '7' = 50%, '?' = 100%

    LED#5 '@ = 0%, 'G' = 50%, 'O' = 100%

    LED#6 'P' = 0%, 'W' = 50%, '_' = 100%

    and so on.

    u_char ledCounter = 8;
    
    while (ledCounter-- > 0) {
    
    	UCB0TXBUF = leds[(ledCounter << 1) + 1] << 4 ;
    	while (!(IFG2 & UCB0TXIFG))
    		; // TX buffer ready?
    
    	UCB0TXBUF = leds[ledCounter << 1];
    	while (!(IFG2 & UCB0TXIFG))
    		; // TX buffer ready?
    
    	UCB0TXBUF = 0;
    	while (!(IFG2 & UCB0TXIFG))
    		; // TX buffer ready?
    }
    

    Now you're confusing me more. I thought this is serial and not random access.

    I update the grayscale data serially, that means one after another.

    But you're specify WHICH led to update. Where you got that from? You got any documentation on that?

     

    Also you're transmitting 3 bytes per LED (counting last '\0'), I only do 12bits.

  4. No, GSCLK and SCLK are two independent clock signals and do not have to be synchronized.

    Use P1.4 (SCLK out) for GSCLK, set timer to upmode, 1:1 SMCLK, and CCR to 0xFFF.

    I should use SCLK pin for GSCLK? I'm not sure I understand what you want to do..

     

    In timer's ISR, pulse BLANK, P1.3 for example.

    but XLAT isn't? Is pulsing BLANK really so resource intensive that you need an timer interrupt for it?

     

    In the flowchart they pulse GSCLK only after data transfer is complete, does this really not need to be synchronized or

    was this just arbitrary that they made it like this?

  5. Doesn't the clock signal need to be synchronized then?

    Because now I'm resetting the PWM counter after 4095 rounds of gsdata upload and not after 4095 cycles.

    Isn't the MSP430G2553 also able to use the USCI HW to control the TLC5940 via SPI?

     

    Also, how do I change the Grayscale data with an USB connection to my PC?

    Is there already a lib for serial connection like with arduino?

  6. Lol, well...I removed everything and connected everything from scratch the dunno maybe like 10th time and now it works..

    This time I used Launchpad's Vcc for the LEDs, though. Trying with external power source now.

     

    Thanks all for your help, especially kylej1050, cde and RobG ! :clap:

     

     

    edit: Tried external power source, works too! Since I changed all wires and reconnected them from scratch, i think there was some fault in the wiring.

     

    edit2: strange, it works sometimes and sometimes not.... :eh: . now its not working anymore :( it blinks sometimes and sometimes its off and then on for a long time

     

    edit3: i think the led is broken..used a different led, its not blinking

  7. Is your breadboard's Vcc connected to LP's Vcc?

    Well, its like that

    MSP and TLC are on the breadboard.

     

    TEST, RST, GND and Vcc of the MSP are connected to the LP.

    TLC's Vcc and GND are also taken from LP.

    Breadboards Vcc aka Vled is only for the leds.

     

    Are you disconnecting LP after programming?

    No, I'm not. Is it worth a try?

    Is there anything I need to do instead then like resistors on any point?

  8. I would recommend using a timer to output your clock signal while the MSP goes about other business. Doesn't matter if you pre-program a routine but if you want the MSP to do anything else while running this chip there is no time for it.

    It's just an initial test programmed like described in the programming flowchart by TI

     

    Do you have bypass capacitors on the breadboard?

    if you mean decoupling capacitors, then yes as you can see in the schematics.

     

    It looks like its a hardware / wiring fault then :/

     

    Have you guys tried it with the MSP430 directly on the Breadboard (not on the launchpad) ?

×
×
  • Create New...