Hello,
I'm having a problem trying to setup UART 0 as a console and configuring FatFs to access the SD card/USB drive at the same time. I'm following the examples "fatsdusbcopy" and "uartconsole" for a TIVA TM4C1294NCPDT. Using my custom board, I can make both of these examples run independently without problem. However, when I try to combine their functionality, execution on my target exits into "trgmsc.c". I don't get any compilation errors, but the code won't execute without crashing. The hardware seems to initialize okay, but when I use puts or printf to send a message to the console, that's when the program exits. It seems like maybe there is a common buffer (CIOBUF???) that may be causing the issue, but I don't understand what's wrong. My code crashes at the printf (it prints about half the string before exiting), shown below:
int main(void) { Task_Params taskParams; /* Call board init functions */ Board_initGeneral(); Board_initGPIO(); Board_initUART(); Board_initSDSPI(); Board_initUSBMSCHFatFs(); add_device("UART", _MSA, UARTUtils_deviceopen, UARTUtils_deviceclose, UARTUtils_deviceread, UARTUtils_devicewrite, UARTUtils_devicelseek, UARTUtils_deviceunlink, UARTUtils_devicerename); // Open UART0 for writing to stdout and set buffer freopen("UART:0", "w", stdout); setvbuf(stdout, NULL, _IOLBF, 128); // Open UART0 for reading from stdin and set buffer freopen("UART:0", "r", stdin); setvbuf(stdin, NULL, _IOLBF, 128); /* * Initialize UART port 0 used by SysCallback. This and other SysCallback * UART functions are implemented in UARTUtils.c. Calls to System_printf * will go to UART0, the same as printf. */ UARTUtils_systemInit(0); /* Construct file copy Task thread */ Task_Params_init(&taskParams); taskParams.stackSize = TASKSTACKSIZE; taskParams.stack = &task0Stack; taskParams.instance->name = "fatsdUSBCopyTask"; Task_construct(&task0Struct, (Task_FuncPtr)taskFxn, &taskParams, NULL); /* Turn on user LED */ GPIO_write(MICA_DEBUG_LED, Board_LED_ON); printf("Starting the FatSD USB Copy example\n"); /* Start BIOS */ BIOS_start();
Can someone provide guidance on how to correct the problem?
Thank you,
Eric