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.
Tool/software:
Hi Ti Family,
I am trying to update the firmware for my MSP430 LaunchPad (used with the TDC7200EVM) using the TDC7200 GUI, but I’m encountering an issue.
I’ve tried the following steps without success:
C:\Program Files (x86)\Texas Instruments\TDC7200EVM\Firmware
.Any help or insights would be greatly appreciated!
Thanks in advance.
Hi, Abhijit
Can you help to confirm that whether CCS can access MSP430 LaunchPad?
And whether TDC7200 GUI has the permission to access USB device?
Regards,
Helic
First, I want to confirm that you are using the correct launchpad since I did not see the part number mentioned. You are using MSP-EXP430F5529LP, correct?
Next, I am not immediately sure why the GUI is not able to flash the launchpad. You could also try using Uniflash(stand-alone programmer) to program the board with the TDC720xEVM-Firmware-v2.07.txt file found in the installation directory. Let me know if you are able to flash using Uniflash.
Hi Eddie,
I am using the MSP430FR6047EVM and successfully programmed the board using UniFlash. However, when I attempt to measure the ToF using a 2-channel function generator, the graph in the GUI fluctuates and does not provide the correct value.
Could you please assist me with this issue?
The MSP430FR6047EVM is not supported by the TDC7200 GUI. The TDC7200EVM uses the 5529 launchpad and TDC7200EVM. You should be using the MSP430FR6047EVM GUI. You will need to flash the correct firmware for the MSP430FR6047 if you have already loaded the TDC7200 firmware, although I would not expect the TDC7200 firmware to be able to program the FR6047 in uniflash since the firmware file is for the F5529 device. You can find the MSP430FR6047 GUI and firmware below.
Hi Eddie,
Thank you for informing me that the MSP430FR6047 is not supported by the TDC7200GUI. I would like to request your help in reviewing my code for Time-of-Flight (ToF) measurement. The setup involves connecting the MSP430FR6047 to the TDC7200EVM and using a two-channel function generator for signal generation.
Below is the code I have implemented:
#include <msp430.h> #include <stdint.h> // Pin Config ****************************************************************** #define SLAVE_CS_OUT P7OUT #define SLAVE_CS_DIR P7DIR #define SLAVE_CS_PIN BIT3 #define SLAVE_RST_OUT P7OUT #define SLAVE_RST_DIR P7DIR #define SLAVE_RST_PIN BIT5 #define BUTTON_DIR P1DIR #define BUTTON_OUT P1OUT #define BUTTON_REN P1REN #define BUTTON_PIN BIT3 #define BUTTON_IES P1IES #define BUTTON_IE P1IE #define BUTTON_IFG P1IFG #define BUTTON_VECTOR PORT1_VECTOR #define BUTTON_LED_OUT P1OUT #define BUTTON_LED_DIR P1DIR #define BUTTON_LED_PIN BIT1 #define COMMS_LED_OUT P1OUT #define COMMS_LED_DIR P1DIR #define COMMS_LED_PIN BIT0 // TDC7200 Register Addresses ************************************************** #define CONFIG1_REG 0x00 #define CONFIG2_REG 0x01 #define TIME1_REG 0x10 #define TIME2_REG 0x11 #define CLOCK_COUNT1_REG 0x12 #define CLOCK_COUNT2_REG 0x13 // Bit Definitions ************************************************************* #define START_MEAS 0x01 #define DUMMY 0xFF #define MAX_BUFFER_SIZE 20 uint8_t MasterType0[1] = {0x11}; uint8_t MasterType1[2] = {8, 9}; uint8_t MasterType2[6] = {'F', '4', '1', '9', '2', 'B'}; uint8_t SlaveType2[6] = {0}; uint8_t SlaveType1[2] = {0}; uint8_t SlaveType0[1] = {0}; // General SPI State Machine *************************************************** typedef enum SPI_ModeEnum{ IDLE_MODE, TX_REG_ADDRESS_MODE, RX_REG_ADDRESS_MODE, TX_DATA_MODE, RX_DATA_MODE, TIMEOUT_MODE } SPI_Mode; /* Used to track the state of the software state machine*/ SPI_Mode MasterMode = IDLE_MODE; /* The Register Address/Command to use*/ uint8_t TransmitRegAddr = 0; /* ReceiveBuffer: Buffer used to receive data in the ISR * RXByteCtr: Number of bytes left to receive * ReceiveIndex: The index of the next byte to be received in ReceiveBuffer * TransmitBuffer: Buffer used to transmit data in the ISR * TXByteCtr: Number of bytes left to transfer * TransmitIndex: The index of the next byte to be transmitted in TransmitBuffer * */ uint8_t ReceiveBuffer[MAX_BUFFER_SIZE] = {0}; uint8_t RXByteCtr = 0; uint8_t ReceiveIndex = 0; uint8_t TransmitBuffer[MAX_BUFFER_SIZE] = {0}; uint8_t TXByteCtr = 0; uint8_t TransmitIndex = 0; /* SPI Write and Read Functions */ SPI_Mode SPI_Master_WriteReg(uint8_t reg_addr, uint8_t *reg_data, uint8_t count); SPI_Mode SPI_Master_ReadReg(uint8_t reg_addr, uint8_t count); void CopyArray(uint8_t *source, uint8_t *dest, uint8_t count); void SendUCA2Data(uint8_t val); void SendUCA2Data(uint8_t val) { while (!(UCA2IFG & UCTXIFG)); // USCI_A2 TX buffer ready? UCA2TXBUF = val; } void CopyArray(uint8_t *source, uint8_t *dest, uint8_t count) { uint8_t copyIndex = 0; for (copyIndex = 0; copyIndex < count; copyIndex++) { dest[copyIndex] = source[copyIndex]; } } SPI_Mode SPI_Master_WriteReg(uint8_t reg_addr, uint8_t *reg_data, uint8_t count) { MasterMode = TX_REG_ADDRESS_MODE; TransmitRegAddr = reg_addr; // Copy register data to TransmitBuffer CopyArray(reg_data, TransmitBuffer, count); TXByteCtr = count; RXByteCtr = 0; ReceiveIndex = 0; TransmitIndex = 0; SLAVE_CS_OUT &= ~(SLAVE_CS_PIN); SendUCA2Data(TransmitRegAddr); __bis_SR_register(GIE); // Enter LPM0 w/ interrupts SLAVE_CS_OUT |= SLAVE_CS_PIN; return MasterMode; } SPI_Mode SPI_Master_ReadReg(uint8_t reg_addr, uint8_t count) { MasterMode = TX_REG_ADDRESS_MODE; TransmitRegAddr = reg_addr; RXByteCtr = count; TXByteCtr = 0; ReceiveIndex = 0; TransmitIndex = 0; SLAVE_CS_OUT &= ~(SLAVE_CS_PIN); SendUCA2Data(TransmitRegAddr); __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ interrupts SLAVE_CS_OUT |= SLAVE_CS_PIN; return MasterMode; } void initSPI() { // Configure SPI P7SEL0 |= (BIT0 | BIT1 | BIT2); P7SEL1 &= ~(BIT0 | BIT1 | BIT2); PM5CTL0 &= ~LOCKLPM5; // Clock Polarity: The inactive state is high // MSB First, 8-bit, Master, 3-pin mode, Synchronous UCA2CTLW0 = UCSWRST; // Put state machine in reset UCA2CTLW0 |= UCCKPL | UCMSB | UCSYNC | UCMST | UCSSEL__SMCLK; // 3-pin, 8-bit SPI Master UCA2BRW = 0x20; UCA2MCTLW = 0; UCA2CTLW0 &= ~UCSWRST; // Initialize USCI state machine UCA2IE |= UCRXIE; // Enable USCI_A2 RX interrupt } void initGPIO() { // LEDs COMMS_LED_DIR |= COMMS_LED_PIN; COMMS_LED_OUT &= ~COMMS_LED_PIN; BUTTON_LED_DIR |= BUTTON_LED_PIN; BUTTON_LED_OUT &= ~BUTTON_LED_PIN; SLAVE_RST_DIR |= SLAVE_RST_PIN; SLAVE_RST_OUT |= SLAVE_RST_PIN; SLAVE_CS_DIR |= SLAVE_CS_PIN; SLAVE_CS_OUT |= SLAVE_CS_PIN; // Button to initiate transfer BUTTON_DIR &= ~(BUTTON_PIN); // button input BUTTON_OUT |= BUTTON_PIN; // button pull up BUTTON_REN |= BUTTON_PIN; // button pull up/down resistor enable BUTTON_IES |= BUTTON_PIN; // button Hi/lo edge BUTTON_IE |= BUTTON_PIN; // button interrupt enabled PM5CTL0 &= ~LOCKLPM5; BUTTON_IFG &= ~BUTTON_PIN; // button IFG cleared } void initClockTo1MHz() { // Configure one FRAM waitstate as required by the device datasheet for MCLK // operation beyond 8MHz _before_ configuring the clock system. //FRCTL0 = FRCTLPW | NWAITS_1; // Clock System Setup CSCTL0_H = CSKEY_H; // Unlock CS registers CSCTL1 = DCOFSEL_0; // Set DCO to 1MHz // Set SMCLK = MCLK = DCO, ACLK = LFXTCLK (VLOCLK if unavailable) //CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; // Per Device Errata set divider to 4 before changing frequency to // prevent out of spec operation from overshoot transient // CSCTL3 = DIVA__4 | DIVS__4 | DIVM__4; // Set all corresponding clk sources to divide by 4 for errata //CSCTL1 = DCOFSEL_4 | DCORSEL; // Set DCO to 16MHz // Delay by ~10us to let DCO settle. 60 cycles = 20 cycles buffer + (10us / (1/4MHz)) //__delay_cycles(60); CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers to 1 for 16MHz operation CSCTL0_H = 0; // Lock CS registers } int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer initClockTo1MHz(); initGPIO(); initSPI(); SLAVE_RST_OUT &= ~SLAVE_RST_PIN; // Now with SPI signals initialized, __delay_cycles(100000); SLAVE_RST_OUT |= SLAVE_RST_PIN; // reset slave __delay_cycles(100000); // Wait for slave to initialize COMMS_LED_OUT |= COMMS_LED_PIN; __bis_SR_register(GIE); // CPU off, enable interrupts // Configure the TDC7200 to start the measurement uint8_t config1_data = 20; // Example: Set measurement mode uint8_t config2_data = 0x40; // Example: Set averaging cycles, other settings while(1){ SPI_Master_WriteReg(CONFIG1_REG, &config1_data, 1); // Write to CONFIG1 //__delay_cycles(100000); //SPI_Master_WriteReg(CONFIG2_REG, &config2_data, 1); // Write to CONFIG2 } // Trigger measurement by writing to CONFIG1 uint8_t start_meas = START_MEAS; // Set the START_MEAS bit SPI_Master_WriteReg(CONFIG1_REG, &start_meas, 1); // Start measurement // Read measurement result from TIME1 SPI_Master_ReadReg(TIME1_REG, 3); // Read TIME1 register (3 bytes) CopyArray(ReceiveBuffer, SlaveType2, 3); // Store results in SlaveType2 array // Optionally, read the TIME2 register if multiple stops are used SPI_Master_ReadReg(TIME2_REG, 3); // Read TIME2 register (3 bytes) CopyArray(ReceiveBuffer, SlaveType1, 3); // Store results in SlaveType1 array __bis_SR_register(LPM0_bits + GIE); // Enter low-power mode while waiting for the result __no_operation(); // For debugger return 0; } // SPI Interrupt #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A2_VECTOR __interrupt void USCI_A2_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USCI_A2_VECTOR))) USCI_A2_ISR(void) #else #error Compiler not supported! #endif { uint8_t uca2_rx_val = 0; switch (__even_in_range(UCA2IV, USCI_SPI_UCTXIFG)) { case USCI_NONE: break; case USCI_SPI_UCRXIFG: uca2_rx_val = UCA2RXBUF; UCA2IFG &= ~UCRXIFG; switch (MasterMode) { case TX_REG_ADDRESS_MODE: if (RXByteCtr) { MasterMode = RX_DATA_MODE; // Need to start receiving now // Send Dummy To Start __delay_cycles(2000000); SendUCA2Data(DUMMY); } else { MasterMode = TX_DATA_MODE; // Continue to transmission with the data in Transmit Buffer // Send First SendUCA2Data(TransmitBuffer[TransmitIndex++]); TXByteCtr--; } break; case TX_DATA_MODE: if (TXByteCtr) { SendUCA2Data(TransmitBuffer[TransmitIndex++]); TXByteCtr--; } else { // Done with transmission MasterMode = IDLE_MODE; __bic_SR_register_on_exit(CPUOFF); // Exit LPM0 } break; case RX_DATA_MODE: if (RXByteCtr) { ReceiveBuffer[ReceiveIndex++] = uca2_rx_val; // Transmit a dummy RXByteCtr--; } if (RXByteCtr == 0) { MasterMode = IDLE_MODE; __bic_SR_register_on_exit(CPUOFF); // Exit LPM0 } else { SendUCA2Data(DUMMY); } break; default: __no_operation(); break; } __delay_cycles(1000); break; case USCI_SPI_UCTXIFG: break; default: break; } } // Button Port Interrupt #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector = BUTTON_VECTOR __interrupt void Button_ISR(void) #elif defined(__GNUC__) void __attribute__((interrupt(BUTTON_VECTOR))) Button_ISR(void) #else #error Compiler not supported! #endif { BUTTON_LED_OUT |= BUTTON_LED_PIN; BUTTON_IFG &= ~BUTTON_PIN; // button IFG cleared BUTTON_IE &= ~BUTTON_PIN; // Initiate __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 }
**Attention** This is a public forum