Running the MSP430F5638 on a custom SBC, using CCS 10.4.0.00006, programming P8 UCA1 for SPI, sending data to an IO Ninja SPI data sniffer. When I send a single text string, the sniffer captures most of the transmissions perfectly. If I send the same string continuously, the success capture rate goes down. It the two devices sync, the data sniffer captures it perfectly. So far, can't get the SBC and the data sniffer in sync all the time.
Transmit a single string: run data sniffer, it opens but waits, start program Tx the string, - usually works
Transmit the same string continuously: run the data sniffer, it opens but waits, start the program, and the sniffer captures something or the correct data, start & stop the sniffer repeatedly
MCU UCA1CTL0 SPI settings CPH = CPOL = 11, MSB 1st = 1, 8 bit = 0, high nibble = 1110 Master = 1, 4 pin = 10, synchronous = 1, low nibble = 1101
Sniffer settings: the same, but CPH has to be 0
I've added a copy of the P8 serial IO circuit, and the P8 SPI setup, and run function code. The program runs "setup_430_P8_SPI_M_TX( )" either once or continuously.
Any suggestions?
// setup_430_P8_SPI_1_M_TX() is either run once sending a single fixed string // or // run continuously in a loop sending the same string void setup_430_P8_SPI_1_M_TX(unsigned char *str) { int i=0, length; length = strlen(str); //SPI_1_M_init_16(); // not working to IO Ninja, don't use SPI_1_M_init(); // works Tx to IO Ninja // 7654 3210 // 0001 1110 = 0x1E P8SEL |= 0x1E; // set alternate function for P8.1, P8.2, P8.3, P8.4 // SPI busy status flag // UCAxSTATW->UCBUSY // 0 not in Tx or Rx mode // 1 busy in either Tx or Rx mode // SPI Tx or Rx buffer full flags // UCAxIFG->UCTXIFG = bit D1 // 0 buffer full, can't load with new data // 1 buffer empty, ready for new data // UCAxIFG->UCRXIFG = bit D0 // 0 buffer empty, can load new char // 1 buffer full, loaded with new char, don't load another char // Tx data // 7654 3210 // 0000 0010 = 0x02 // Tx while test // true = while loops forever until test fails // 0 ANDed with anything = 0, negated = 1 // false = while loop ends, code proceeds // both must be true and get negated to 0 for (i = 0; i < length; i++) { while(!(UCA1IFG & 2)) // wait for transmit buffer empty ; UCA1TXBUF = str[i]; // transmit a character // was 10, not triggering consistently // try 50, same - triggers about 1/2 the time // try 500, same delayMs(10); } } void SPI_1_M_init(void) { UCA1CTL1 = 0x01; // disable UCA1 during configuration // 1110 = high nibble // clock phase = 1, polarity = 1, MSB first = 1, 8 bit = 0 // 1101 = low nibble // Master = 1, 4-pin SPI = 1, STE low active = 0, synchronous mode = 1 // 7654 3210 // 1110 1101 = 0xED // CPH = CPOL = 11, MSB 1st = 1, 8 bit = 0 Master = 1, 4 pin STE low & slave enabled low = 10, Synch = 1 UCA1CTL0 = 0xED; // 7654 3210 // 1000 0001 = 0x81 // SMCLK = 10, Don't care xxxxx, software reset = 1 UCA1CTL1 = 0x81; // both EUSCI_B3-> and EUSCI_B3_SPI-> work or don't work consistently - they aren't the issue // BRW = divisor // tested BRW = 2 to 64, must be >= 6 when using X2 @ 24 MHz (432) or XT2 @ 20 MHz (430) //EUSCI_B3_SPI->BRW = 1; // DCO = 3 MHz / 1 = 3 MHz //EUSCI_B3->BRW = 8; // X2 = 24 MHz / 8 = 3 MHz (must be >= 6 to work) UCA1BRW = 7; // X2 = 20 MHz / 7 = ~3 MHz (must be >= 6 to work) UCA1CTL1 &= ~0x01; // enable UCA1 for use after configuration }