Part Number: MSP432P401R
Other Parts Discussed in Thread: SYSCONFIG
Hi, below is a snippet of the basic code I'm running.
void gpioButtonFxn0(uint_least8_t index)
{
/* Clear the GPIO interrupt and toggle an LED */
GPIO_toggle(Board_GPIO_LED0);
res = ADC_convert(adc, &adcValue0);
adcValue0MicroVolt = ADC_convertRawToMicroVolts(adc, adcValue0);
printf("%d\n", adcValue0MicroVolt);
UART_write(uart, &adcValue0MicroVolt, sizeof(adcValue0MicroVolt));
printf("UART_write() finished\n");
}
/*
* ======== mainThread ========
*/
void *mainThread(void *arg0)
{
/* Call driver init functions */
GPIO_init();
ADC_init();
UART_init();
// I2C_init();
// SPI_init();
// Watchdog_init();
// initialiaze ADC
ADC_Params_init(¶ms);
adc = ADC_open(Board_ADC0, ¶ms);
if (adc == NULL) {
printf("ADC_open() failed\n");
while (1);
}
// initialize UART
UART_Params_init(&uartParams);
uartParams.writeMode = UART_MODE_CALLBACK;
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
printf("UART_open() failed\n");
while (1);
}
/* Turn on user LED */
GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
/* Enable interrupts */
GPIO_enableInt(Board_GPIO_6_1);
while (1) {
sleep(1);
printf("In while loop...\n");
}
}
If I comment out the UART_write() line in my callback function, I'm able to continuously toggle my LED and perform ADC conversions (at the same time, "In while loop..." keeps printing). However, with the UART_write() command, the execution of this code completely stops. I reach the printing "UART_write() finished" portion, but my code no longer executes. Does anyone know why this may be?
Regards,
Michael