Hi,
I'm having trouble with the ROM bootloader. I'm using an LM4F Launchpad.
If I put these lines as the first lines of my Main() ...
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); //set the clocking to run from the PLL at 50MHz
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 38400, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
ROM_UpdateUART(); //will not return from here - needs hardware reset
...the ROM_BootLoader is run and I can update the code using LMFlash with AutoBaud Off fixed at 38400. All good as a test and is equivalent to the example that Chester found for me yesterday.
Now I want to be able to run the bootloader from within my app (which uses the UART with interrupt driven fifos), so I use this code...
ROM_IntMasterDisable(); //disable interrupts
ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOA); //get UART reset to simple, no interrupts, no handshake
ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_UART0);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 38400, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
ROM_UpdateUART(); //will not return from here - needs hardware reset
...this appears to run the bootloader but I cannot get LMFlash to communicate.
Suspecting that there's something left running in my code which is interfering with the proper operation of the bootloader I tried a software reset...
...so from within my app I call ROM_SysCtlReset()
then at the top of my Main() I have...
if((ROM_SysCtlResetCauseGet() & SYSCTL_CAUSE_SW) != 0) { //detect if reset came from within app
ROM_SysCtlResetCauseClear(SYSCTL_CAUSE_SW);
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // Set the clocking to run from the PLL at 50MHz
ROM_IntMasterDisable(); //disable interrupts master
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 38400, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
while(ROM_UARTCharsAvail(UART0_BASE)) //empty the fifo just incase?
i = ROM_UARTCharGetNonBlocking(UART0_BASE);
ROM_UpdateUART(); //will not return from here - needs hardware reset
}
...but I still cannot get LMFlash to communicate
Can anyone suggest what I've done wrong please?
Thank you.