想用ARM里的内置EEPROM存储一些东西,从板子带的例子uart echo改的。
发现调用
SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
ROM_EEPROMInit();
//ROM_EEPROMProgram(pui32Data, 0x100, sizeof(pui32Data));
//ROM_EEPROMRead(pui32Read, 0x100, sizeof(pui32Read));
根本无法操作EEPROM,而且程序反复出现下列情况:
(1)程序跑飞
(2)如果再重新下载程序,就出现,下载不了程序
具体程序如下
- #include <stdint.h>
- #include <stdbool.h>
- #include "inc/hw_ints.h"
- #include "inc/hw_gpio.h"
- #include "inc/hw_memmap.h"
- #include "inc/hw_types.h"
- #include "driverlib/debug.h"
- #include "driverlib/gpio.h"
- #include "driverlib/interrupt.h"
- #include "driverlib/sysctl.h"
- #include "driverlib/uart.h"
- #include "driverlib/rom.h"
- #include "grlib/grlib.h"
- #include "drivers/kentec320x240x16_ssd2119.h"
- #include "drivers/frame.h"
- #include "drivers/pinout.h"
- #include "driverlib/eeprom.h"
- #include "driverlib/rom.h"
- #include "driverlib/pin_map.h"
-
- #ifdef DEBUG
- void
- __error__(char *pcFilename, uint32_t ui32Line)
- {
- }
- #endif
-
- //*****************************************************************************
- //
- // The UART interrupt handler.
- //
- //*****************************************************************************
- void
- UARTIntHandler(void)
- {
- uint32_t ui32Status;
-
- //
- // Get the interrrupt status.
- //
- ui32Status = ROM_UARTIntStatus(UART0_BASE, true);
-
- //
- // Clear the asserted interrupts.
- //
- ROM_UARTIntClear(UART0_BASE, ui32Status);
-
- //
- // Loop while there are characters in the receive FIFO.
- //
- while(ROM_UARTCharsAvail(UART0_BASE))
- {
- //
- // Read the next character from the UART and write it back to the UART.
- //
- unsigned char temp = UARTCharGetNonBlocking(UART0_BASE);
- ROM_UARTCharPutNonBlocking(UART0_BASE,temp);
- }
- }
-
- //*****************************************************************************
- //
- // Send a string to the UART.
- //
- //*****************************************************************************
- void
- UARTSend(const uint8_t *pui8Buffer, uint32_t ui32Count)
- {
- //
- // Loop while there are more characters to send.
- //
- while(ui32Count--)
- {
- //
- // Write the next character to the UART.
- //
- ROM_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++);
- }
- }
-
- //*****************************************************************************
- //
- // This example demonstrates how to send a string of data to the UART.
- //
- //*****************************************************************************
- int
- main(void)
- {
- uint32_t ui32SysClock;
- tContext sContext;
- ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
- SYSCTL_OSC_MAIN |
- SYSCTL_USE_PLL |
- SYSCTL_CFG_VCO_480), 120000000);
-
- {
- ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
- ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
- ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
- ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
- }
- SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
- //
- // Enable processor interrupts.
- //
- IntMasterEnable();
-
- //
- // Configure the UART for 115,200, 8-N-1 operation.
- //
- ROM_UARTConfigSetExpClk(UART0_BASE, ui32SysClock, 115200,
- (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
- UART_CONFIG_PAR_NONE));
- ROM_IntEnable(INT_UART0);
- //ROM_EEPROMInit();
- ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
-
- //
- // Prompt for text to be entered.
- //
- UARTSend((uint8_t *)"0nter text: ", 12);
- while(1)
- {
- }
- }