This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Im using the razor 9DOF IMU and trying to interface through UART with a fr5969. Even though i feel like my code is correct i keep getting errors in the output. I am using a 115200 baud rate. If anyone could give me some tips it would be greatly appreciated.
Below i have given part of the output i am getting and my code.
* Gz=6 | ÿ91 -599 174 Headings ÿ*ÿ496
Az=869 | Gx=9 Gy=3 Gz=6 | ¦éå3 Gz=6 | ÿ94 -599 175 Headings =869 | Gx=9 Gy=3 Gz=6 |
ÿ85 -599 179 Headings åÿ487 Az=869 | Gx=9 Gy=3 Gz=6 | ÿ91 -593 164 Hea=8ngs ²rÂÊ
jþ495 Az
=863 | Gx=9 Gy=3 Gz=6 | ÿ82 -600 161 Headings å-487 Az=869 | Gx=9 Gy=3 Gz=6 | ÿ91 -603
176 Hedinggs å-496 Az=866 | Gx=9 Gy=3 Gz=6 | ÿ95 -599 171 Hegs gs Az=873 | Gx=9 Gy=3
Gz=6 | ÿ95 -599 171 Headings g*ÿ497 Az=865 | Gx=9 Gy=2 Gz=6 | ÿ599 171 Headings w
Code-
P2SEL1 |= BIT0 | BIT1;
P2SEL0 &= ~(BIT0 | BIT1);
PM5CTL0 &= ~LOCKLPM5;
CSCTL0_H = CSKEY >> 8;
CSCTL1 = DCOFSEL_3 | DCORSEL;
CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;
CSCTL0_H = 0; // Lock CS registers
UCA0CTLW0 = UCSWRST; // Put eUSCI in reset
UCA0CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK
UCA0BR0 = 4;
UCA0BR1 = 0x00;
UCA0MCTLW = (0x55 << 8| 0x5 << 4 | 0x1 );
UCA0CTLW0 &= ~UCSWRST;
UCA0IE |= UCRXIE;
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3, interrupts enabled
__no_operation(); // For debugger
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR //directive that tells the compiler that the XXX interrupt will be served by the following function
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
while(!(UCA0IFG&UCTXIFG));
UCA0TXBUF = UCA0RXBUF;
__no_operation();
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
}
}
Without going through your complete code - I don't know if using the UART with such a high baudrate while using the DCO instead of a crystal will work without problems. This is just a guess. What problems do you have? Have you tried sending/receiving data at a lower frequency?
I tried sending just the letter 'A' at 115200 and still go errors.
Gz=6 | ÿ91 -599 174 Headings ÿ*ÿ496
Az=869 | Gx=9 Gy=3 Gz=6 | ¦éå3 Gz=6 | ÿ94 -599 175 Headings =869 | Gx=9 Gy=3 Gz=6 |
ÿ85 -599 179 Headings åÿ487 Az=869 | Gx=9 Gy=3 Gz=6 | ÿ91 -593 164 Hea=8ngs ²rÂÊ
jþ495 Az
should be something like
Ax=# Ay=# Az=# | Gx=# Gy=# Gz=# | # # # Heading = #
With a lower baud rate, 9600, it was fine. I used my friend Xbee explorer to test the IMU at 115200 and it worked without errors. So i know it supports such a high baud rate.
57600 doesn't work for me.
**Attention** This is a public forum