Other Parts Discussed in Thread: CC2560
I want to see if I can send a HCI command to my 2560 using the EZ430 usb kit. My understanding is I need to setup UART 2, power the cc2560, Send a HCI reset, on any return data I want to turn on an LED just as a test to see something is working. My LED isn't turning on... I think I am not powering the cc2560 correctly but I don't know how to verify that.
Setup the LEDs
P1DIR |= 0x01;
P1DIR |= 0x02;
Setup UART 2 to 115200 8n1. I have done this and I can see data on J2.
P9SEL = 0x30; // P9.4,5 = USCI_A2 TXD/RXD
P1SEL = 0x18; // P1.3,4 = USCI_A2 RTC/CTS
UCA2CTL1 |= UCSWRST; // **Put state machine in reset**
UCA2CTL1 |= UCSSEL_2; // Clock Source: SMCLK
UCA2BR0 = 0x09; // 1MHz 115200 (see User's Guide)
UCA2BR1 = 0x00; //
UCA2MCTL = UCBRS_1+UCBRF_0; // Modulation UCBRSx=1, UCBRFx=0
UCA2CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA2IE |= UCRXIE; // Enable USCI_A2 RX interrupt
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCI_A2_VECTOR
__interrupt void USCI_A2_ISR(void)
{
switch(__even_in_range(UCA2IV,4))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
P1OUT |= 0x02; //Turn on led
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}
Power on the cc2560. I don't know how I can verify I am doing this correctly. I am doing the following
//setup the clock on p2.6
P2SEL |= 0x40;
//set up port p2.7 for power
P2DIR |= 0x80; //set up as output
Send my HCI reset command
while (!(UCA2IFG&UCTXIFG));
UCA2TXBUF = 0x01;
while (!(UCA2IFG&UCTXIFG));
UCA2TXBUF = 0x0c;
while (!(UCA2IFG&UCTXIFG));
UCA2TXBUF = 0x03;
while (!(UCA2IFG&UCTXIFG));
UCA2TXBUF = 0x00;