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: Code Composer Studio
Hello TI team,
I'm running my code on msp430f5529 and I have a problem : when the code call the function read_i2c() the function work fine but when I call the UART interrupt to send data with uart, the program don't listen to uart interrupt and keep reading. By the way I disabled I2C interrupt because I don't use it .
This is my UART interrupt code :
#pragma vector=USCI_A0_VECTOR __interrupt void USCI_A0_ISR(void) { static volatile unsigned short k = 0; switch(__even_in_range(UCA0IV,4)) { case 0:break; // Vector 0 - no interrupt case 2: // Vector 2 - RXIFG if(uart_time_out>10000){k = 0;uart_time_out=0;} uartReceive[k++] = UCA0RXBUF; if(k == 7){k = 0; UARTdataReceived_event = 1;} break; case 4:break; // Vector 4 - TXIFG default: break; } }
Anyone can help please.
Hello,
Thank you for your post. It sounds like your UART interrupts aren't getting enabled, but you haven't shared your UART configuration and setup code. I'd highly recommend referencing our UART code examples. Compare your code to them, and you should be able to see what's different and that's most likely causing the issue.
Regards,
James
Hello James,
This is my uart configuration :
void BLE_initUart() { GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P3, GPIO_PIN3 + GPIO_PIN4 ); // P3.4,5 = USCI_A0 TXD/RXD //................ UCA0CTL1 |= UCSWRST; // **Put state machine in reset** USCI_A_UART_initParam param = {0}; param.selectClockSource = USCI_A_UART_CLOCKSOURCE_ACLK; param.clockPrescalar = 26; param.firstModReg = 0; param.secondModReg = 0; param.parity = USCI_A_UART_NO_PARITY; param.msborLsbFirst = USCI_A_UART_LSB_FIRST; param.numberofStopBits = USCI_A_UART_ONE_STOP_BIT; param.uartMode = USCI_A_UART_MODE; param.overSampling = USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION; if(STATUS_FAIL == USCI_A_UART_init(USCI_A0_BASE, ¶m)) { return; } UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt USCI_A_UART_enableInterrupt(USCI_A0_BASE,USCI_A_UART_RECEIVE_INTERRUPT); }
I download uart code examples but it seems like mine , I can't found the problem in.
By the way I use spi to communicate with other sensors and the uart interruptions work fine but only with I2C communications the uart interruptions didn't work.
Hello Bruce,
Yes I did the breakpoint and I noticed that the ISR is called and did her work properly, but as you say the loop while(1) never notices
the problem is solved now , I had a problem on my state machine synchronization.
**Attention** This is a public forum