Other Parts Discussed in Thread: MSP-EXP430FR5994
Tool/software: Code Composer Studio
Hi,
Environment: Using the MSP-EXP430FR5994 board. Development using CCS Version: 8.1.0.00011.
Problem: UART data transmission stops working when I move .data section to the FRAM. --data-model=large, --code-model=large
TestApp_A - I have a small test application (adapted Blink LED example) which can successfully use the UART to send messages to my PC COM4 port. I am also using driverlib for interfacing with the UART. I can see the UART messages coming through on my PC just fine.
TestApp_B - I want to use this UART code in another larger application (TestApp_B), which, due to it's size, has it's .data section moved to the FRAM via the linker.
So, now to experiment on the smaller app, I made the same change in TestApp_A : i.e. moved the .data section to the FRAM. Kept CCS default config for the MPU settings. I'm not using #pragma PERSISTENT as I want ALL of the .data in the FRAM rather than a few global variables. But once I do this, I can no longer see any messages coming through the UART. The program runs without crashing, as I can see the LED blinking (adapted Blink LED app as mentioned earlier) and I can step through using the CCS Debugger.
From the thread below - I think it's an issue with the write protection - the MPU is enabled and the linked by default is placing the .data in FRAM in a location that is Read Only.
However, I can't figure out an easy way to tell the linker to place the .data in a R+W location in FRAM. I still want to use the automatic MPU/segment management. how can I setup the .cmd so that I can tell the linker to place the .data in a R+W region ?
Many thanks !
Rosh
Linker changes:
.data : {} > FRAM (HIGH) /* Global & static vars */
Snippet of the UART code (can't post full code as it's from a work colleague) - to clarify the UART works fine before placing .data into FRAM
... ... CS_setDCOFreq(CS_DCORSEL_0, CS_DCOFSEL_6); CS_initClockSignal( CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1 ); ... ... UartParams = {//8MHz EUSCI_A_UART_CLOCKSOURCE_SMCLK, 52, // clockPrescalar 1, // firstModReg 73, // secondModReg EUSCI_A_UART_NO_PARITY, EUSCI_A_UART_LSB_FIRST, EUSCI_A_UART_ONE_STOP_BIT, EUSCI_A_UART_MODE, EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION } ... ... EUSCI_A_UART_initParam param = UartParams; EUSCI_A_UART_enable(EUSCI_A0_BASE); EUSCI_A_UART_clearInterrupt(EUSCI_A0_BASE,EUSCI_A_UART_RECEIVE_INTERRUPT); // Enable USCI_A0 RX interrupt EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT); // Enable globale interrupt __enable_interrupt(); // Select UART TXD on P2.0 GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION); ... ... EUSCI_A_UART_transmitData(EUSCI_A0_BASE, (uint8_t)'a'); ... ..