工具与软件:
如何配置 EK-TM4C1294XL 上的闪存、我想将闪存分成闪存块、以存储数据地址和访问
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具与软件:
如何配置 EK-TM4C1294XL 上的闪存、我想将闪存分成闪存块、以存储数据地址和访问
您好!
每个块为16kB。 因此、您可以将数据放置在16kB 的边界。 请参阅 FlashProgram 和 FlashErase API 来对闪存中的数据进行编程和擦除。
下面我们举一个简单的例子。
uint32_t pui32Data[2]; // // Erase a block of the flash. // FlashErase(0x800); // // Program some data into the newly erased block of the flash. // pui32Data[0] = 0x12345678; pui32Data[1] = 0x56789abc; FlashProgram(pui32Data, 0x800, sizeof(pui32Data));
您好、Charles Tsal
我们参考了您的示例并参考了您回复的其他文章
e2e.ti.com/.../sw-dk-tm4c129x-tm4c129-internal- memory-read-write
这里我们遇到一个问题、即如何在 Code Composer Studio 的 IDE 中观察闪存位置。 我们需要确定它是否写入正确。
2.如何使用这里是一个简单的例子。 您是否需要包含特定函数库?
EK-TM4C1294XL 和 MSP430F2xx 之间的闪存拆分方法是否不同?
EK-TM4C1294XL 是否需要定义自己的块、或者 MSP430F2xx 中的闪存是否具有主存储器和信息存储器?
如何使用 EEPROM? 与闪存相同吗? 我需要使用 UART 来写入和读取数据。
这里我们遇到一个问题、即如何在 Code Composer Studio 的 IDE 中观察闪存位置。 我们需要确定它是否写入正确。
2.如何使用这里是一个简单的例子。 您是否需要包含特定函数库?
[报价]您好!
抱歉、用户指南中显示的示例不理想。 原因是要编程的地址为0x800。 这通常是主代码所在的地址、具体取决于主程序的大小。 因此、我希望在0x800处您应该已经有一些代码。 我建议您尝试使用其他主代码未驻留的地址。 如果您确定自己没有任何内容、也许您可以尝试0x8000或0xC0000等地址。 首先将源代码编程到闪存中并检查地址0x8000。 此位应是已擦除状态下的0xFFFFFFFF。 接下来、使用某个值对该位置进行编程、并使用"Memory"窗口重新检查该地址以查看其值是否发生变化。
[报价 userid="601810" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1380725/ek-tm4c1294xl-how-to-configuration-flash-memory-on-ek-tm4c1294xl/5278394 #5278394"]EK-TM4C1294XL 和 MSP430F2xx 之间的闪存拆分方法是否不同?
EK-TM4C1294XL 是否需要定义自己的块、或者 MSP430F2xx 中的闪存是否具有主存储器和信息存储器?
[报价]我不支持 MSP432F2xx、因此不知道闪存在 MCU 中是如何组织的。 我不认为闪存组织会是一样的。 您需要阅读 MSP432F2xx 数据表、了解它们如何组织闪存及其架构。
[报价 userid="601810" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1380725/ek-tm4c1294xl-how-to-configuration-flash-memory-on-ek-tm4c1294xl/5278394 #5278394"]如何使用 EEPROM? 与闪存相同吗? 我需要使用 UART 来写入和读取数据。
[报价]EEPROM 是一个完全不同的闪存块、其仿真方式与 EEPROM 在读取和写入操作方面的运行方式类似。 请参阅外设驱动程序用户指南中的 EEPROM 操作及其操作架构数据表。
9.3 Programming Example The following example shows how to use the EEPROM API to write a block of data and read it back. uint32_t ui32EEPROMInit; uint32_t pui32Data[2]; uint32_t pui32Read[2]; // // Enable the EEPROM module. // SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); // // Wait for the EEPROM module to be ready. // while(!SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0)) { } // // Wait for the EEPROM Initialization to complete // ui32EEPROMInit = EEPROMInit(); // // Check if the EEPROM Initialization returned an error // and inform the application // if(ui32EEPROMInit != EEPROM_INIT_OK) { while(1) { } } // // Program some data into the EEPROM at address 0x400. // pui32Data[0] = 0x12345678; pui32Data[1] = 0x56789abc; EEPROMProgram(pui32Data, 0x400, sizeof(pui32Data)); // // Read it back. // EEPROMRead(pui32Read, 0x400, sizeof(pui32Read));
另外、请注意与 EEPROM 相关的一些已知勘误表。 请参阅勘误表。
我使用了您提供的 EEPROM 示例程序、运行该程序后、我使用存储器浏览器观察地址0x400的位置、发现地址0x400的位置没有写入 EEPROM。
2.6KB EEPROM 地址0x200 - 0x43C ?
[报价]否、EEPROM 存储器未进行存储器映射。 您无法使用存储器浏览器查看 EEPROM 内容。 您只需要使用 EEPROMRead () API 来读取它。
您好、查尔斯·蔡、感谢您的帮助
我已经能够正常运行示例、将数据写入 EEPROM 并使用 UART 从 EEPROM 读取数据。 请参阅 e2echina.ti.com/.../ccs-ek-tm4c1294xl-eeprom 示例 、但我想使用 EEPROM 将数据写入96个块、但当前程序无法写入96个块、并且最多只能写入48个块、然后再读回。 我想问我的程序是否有问题或者我是否需要使用其他程序。 存储器地址
是否还有其他 TI 工具可以帮助我们查看 EEPROM 的位置及其数据内容?
我想问一下变量是否可以观察我的 EEPROM 的地址和值。
//***************************************************************************** // // hello.c - Simple hello world example. // // Copyright (c) 2013-2020 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2.2.0.295 of the EK-TM4C1294XL Firmware Package. // //***************************************************************************** #include <stdint.h> #include <stdbool.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/gpio.h" #include "drivers/pinout.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "utils/uartstdio.h" #include "driverlib/eeprom.h" #define j 48 // only 48 //***************************************************************************** // //! \addtogroup example_list //! <h1>Hello World (hello)</h1> //! //! A very simple ``hello world'' example. It simply displays ``Hello World!'' //! on the UART and is a starting point for more complicated applications. //! //! Open a terminal with 115,200 8-N-1 to see the output for this demo. // //***************************************************************************** //***************************************************************************** // // System clock rate in Hz. // //***************************************************************************** uint32_t g_ui32SysClock; int i; //***************************************************************************** // // The error routine that is called if the driver library encounters an error. // //***************************************************************************** #ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line) { } #endif //***************************************************************************** // // Configure the UART and its pins. This must be called before UARTprintf(). // //***************************************************************************** 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. // MAP_UARTCharPutNonBlocking(UART0_BASE, *pui8Buffer++); } } void ConfigureUART(void) { // // Enable the GPIO Peripheral used by the UART. // MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Enable UART0 // MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // Configure GPIO Pins for UART mode. // MAP_GPIOPinConfigure(GPIO_PA0_U0RX); MAP_GPIOPinConfigure(GPIO_PA1_U0TX); MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Initialize the UART for console I/O. // UARTStdioConfig(0, 115200, g_ui32SysClock); } //***************************************************************************** // // Print "Hello World!" to the UART on the Intelligent UART Module. // //***************************************************************************** int main(void) { // // Run from the PLL at 120 MHz. // Note: SYSCTL_CFG_VCO_240 is a new setting provided in TivaWare 2.2.x and // later to better reflect the actual VCO speed due to SYSCTL#22. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240), 120000000); // // Configure the device pins. // PinoutSet(false, false); // // Enable the GPIO pins for the LED D1 (PN1). // MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1); // // Initialize the UART. // ConfigureUART(); // // Hello! // // // We are finished. Hang around flashing D1. // while(1) { uint32_t e2block; uint32_t ui32EEPROMInit; uint32_t pui32Data[j]; uint32_t pui32Read[j]; // // Enable the EEPROM module. // SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0); // // Wait for the EEPROM module to be ready. // while(!SysCtlPeripheralReady(SYSCTL_PERIPH_EEPROM0)) { } // // Wait for the EEPROM Initialization to complete // ui32EEPROMInit = EEPROMInit(); // // Check if the EEPROM Initialization returned an error // and inform the application // if(ui32EEPROMInit != EEPROM_INIT_OK) { while(1) { } } // // Program some data into the EEPROM at address 0x400. // SysCtlDelay(50000000); for(i=0;i<j;i++) { pui32Data[i] = (i + 1) * 0x11111111; // }; EEPROMProgram(pui32Data,0x400, sizeof(pui32Data)); //0x17FC EEPROMRead(pui32Read, 0x400, sizeof(pui32Read)); for (i=0;i<j;i++) { UARTprintf("number: %d\n", i ); UARTprintf("Data read from EEPROM: %x\n", pui32Read[i]); // SysCtlDelay(30000000); }; //UARTprintf("Data read from EEPROM SIze: %d\n",EEPROMSizeGet()); } }
查尔斯·蔡先生:
您提到的定义程序问题已经过测试、只有在 J 输入到48 MCU 时才有效。 如果 MCU 超过48 (例如50)、它将不会运行。 我的程序和示波器的波形如下所示。
2.我想问一下位置是否会自动排序。 请参考编译器/EK-TM4C1294XL:如何将 EEPROM 的两个连续位置读取到结构中。 本文发现、EEPROM_ADDRESS 需要从0x0000开始定义、并且每次都会增加偏移量。 我想问是否有必要这样做。 从(0x000...0x095)定义96个地址或为每四个地址(0x000...0x17c)定义一个地址
我尝试使用他的方法,但仍然失败,而不是直接使用(0x400)自动排序。
您好!
EEPROM 偏移地址0x400对应于块#16。 EEPROM 地址0xC80对应于块#50、地址0x1800对应于块#96。
我使用下面的代码对 EEPROM 进行一些写入操作、然后单步执行代码、我将获得正确的数据。
//
// Program some data into the EEPROM at address 0x400.
//
pui32Data[0] = 0x12345678;
pui32Data[1] = 0x56789abc;
EEPROMProgram(pui32Data, 0x400, sizeof(pui32Data));
//
// Read it back.
//
EEPROMRead(pui32Read, 0x400, sizeof(pui32Read));
pui32Data[0] = 0x11223344;
pui32Data[1] = 0x55667788;
EEPROMProgram(pui32Data, 0xc80, sizeof(pui32Data));
//
// Read it back.
//
EEPROMRead(pui32Read, 0xc80, sizeof(pui32Read));
pui32Data[0] = 0xAABBCCDD;
pui32Data[1] = 0xDEADBEEF;
EEPROMProgram(pui32Data, 0x1800, sizeof(pui32Data));
//
// Read it back.
//
EEPROMRead(pui32Read, 0x1800, sizeof(pui32Read));
请参阅有关 EEPROM 组织结构的数据表。 有96个块、每个块为16个字或64个字节。 每个字等于4个字节。
8.2.4.1功能描述
EEPROM 模块提供了一个定义明确的寄存器接口来支持到 EEPROM 的访问
读取和写入的随机访问样式以及滚动或顺序访问方案。
保护机制可以锁定 EEPROM 块、以防止在一组下进行写入
也可以是相同或不同情况下的读数。 密码模型
允许应用程序锁定一个或多个 EEPROM 块、以控制16字边界的访问。
调节
EEPROM 中有96个16字的块。 这些都是可读的、并且可以写为字。
可以读取字节和半字、而且访问不必发生在字边界。
整个字被读取、任何不需要的数据将被忽略。 EEPROM 块可写入
仅限于字数。 要写入字节、需要读取字值、修改相应的值
并将字写回。
每个块都可以用块选择寄存器进行寻址、地址是 EEPROM 中的偏移量。 每个
字是在所选块内可寻址的偏移量。
1.方案1.
我们目前的理解是每64个字节定义一个 EEPROM 地址。 我们的程序将从地址0x000开始、每隔0x040定义一次、直到96 个块地址为0x1800。以这种方式定义的 EEPROM 地址和数据是否正确?
[报价]正确、每个 EEPROM 块为16字宽、这意味着是64字节。
[报价 userid="601810" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1380725/ek-tm4c1294xl-how-to-configuration-flash-memory-on-ek-tm4c1294xl/5295441 #5295441"]2.方案2.
如果程序定义的 EEPROM 地址和数据超过96个块、是否会出现任何问题?
[报价]我不知道如果你定义超过96个块会发生什么。 我建议您不要超过96个块(这是在 MCU 上实现的最大值)、因为这种行为是未知的。
3.UARTCharGetNonBlocking 无法调用 UARTprintf
我不明白你的意思。 您能否看一下 hello 示例或其他调用 UARTPrintf()的示例。 请首先尝试 hello 示例、然后了解其工作原理并通过 COM 端口打印到终端。
查尔斯·蔡先生:
我们有一些数据以1字节的形式传输 我想询问 EEPROM 是否可以在1个字节(而不是字)中写入数据。
2.in 在本示例中、仅使用16个十六进制数字、这意味着仅使用16个字。 我想问是否可以使用16个十六进制64字节?
例如、uint32_t 更改为 uint8、您能否告诉我使用了以下3个定义中的哪一个?
1. pui32Data[0] = 0xAA; // 1byte pui32Data[1] = 0xBB; // 2byte . . . pui32Data[62] = 0xEE;// 63byte pui32Data[63] = 0xFF;// 64byte or 2. pui32Data[0] = 0xAAAAA........AAA; //32bytes pui32Data[1] = 0xBBBBB........BBB; //32bytes or 3. pui32Data[0] = 0xAAAAA..................AAA; //64bytes
查尔斯·蔡先生:
很抱歉我不理解
方案1.
pui32Data 的最大范围可以是 pui32Data[16]或 pui32Data[2]
pui32Data 的范围是否可以是 pui32Data[0-15]中的64字节?
原始示例是 pui32Data[0-1] 8字节
方案1.
pui32Data[0] = 0xAAAAAAAA; //8bytes pui32Data[1] = 0xBBBBBBBB; //8bytes . . . pui32Data[14]=0xEEEEEEEE; pui32Data[15]=0xFFFFFFFF;
方案2.
我们这里有大约1KB 的十六进制数据。 我想问。 根据您描述的 EEPROM、它的数据格式为字(4字节)、但它只能写入16个字而无法写入。
建议将数据写入闪存 或其他地方?
方案2.
uint8 list_1[1024]= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x00, 0x11, 0x00, 0x99, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,......... 0xff };
很抱歉我不理解
方案1.
pui32Data 的最大范围可以是 pui32Data[16]或 pui32Data[2]
pui32Data 的范围是否可以是 pui32Data[0-15]中的64字节?
原始示例是 pui32Data[0-1] 8字节
Jeremy、您好!
EEPROMProgram() 尝试隐藏块数方面的硬件细节。 API 将抽象硬件细节、就像 EEPROM 由单个块组成一样。 请参阅以下源代码。 当 pui32Data 大小超过物理 EEPROM 块大小时、API 将推进到下一个物理块编号。
uint32_t EEPROMProgram(uint32_t *pui32Data, uint32_t ui32Address, uint32_t ui32Count) { uint32_t ui32Status; // // Check parameters in a debug build. // ASSERT(pui32Data); ASSERT(ui32Address < SIZE_FROM_EESIZE(HWREG(EEPROM_EESIZE))); ASSERT((ui32Address + ui32Count) <= SIZE_FROM_EESIZE(HWREG(EEPROM_EESIZE))); ASSERT((ui32Address & 3) == 0); ASSERT((ui32Count & 3) == 0); // // Make sure the EEPROM is idle before we start. // do { // // Read the status. // ui32Status = HWREG(EEPROM_EEDONE); } while(ui32Status & EEPROM_EEDONE_WORKING); // // Set the block and offset appropriately to program the first word. // HWREG(EEPROM_EEBLOCK) = EEPROMBlockFromAddr(ui32Address); HWREG(EEPROM_EEOFFSET) = OFFSET_FROM_ADDR(ui32Address); // // Convert the byte count to a word count. // ui32Count /= 4; // // Write each word in turn. // while(ui32Count) { // // This is a workaround for a silicon problem on Blizzard rev A. We // need to do this before every word write to ensure that we don't // have problems in multi-word writes that span multiple flash sectors. // if(CLASS_IS_TM4C123 && REVISION_IS_A0) { _EEPROMSectorMaskSet(ui32Address); } // // Write the next word through the autoincrementing register. // HWREG(EEPROM_EERDWRINC) = *pui32Data; // // Wait a few cycles. In some cases, the WRBUSY bit is not set // immediately and this prevents us from dropping through the polling // loop before the bit is set. // SysCtlDelay(10); // // Wait for the write to complete. // do { // // Read the status. // ui32Status = HWREG(EEPROM_EEDONE); } while(ui32Status & EEPROM_EEDONE_WORKING); // // Make sure we completed the write without errors. Note that we // must check this per-word because write permission can be set per // block resulting in only a section of the write not being performed. // if(ui32Status & EEPROM_EEDONE_NOPERM) { // // An error was reported that would prevent the values from // being written correctly. // if(CLASS_IS_TM4C123 && REVISION_IS_A0) { _EEPROMSectorMaskClear(); } return(ui32Status); } // // Move on to the next word. // pui32Data++; ui32Count--; // // Do we need to move to the next block? This is the case if the // offset register has just wrapped back to 0. Note that we only // write the block register if we have more data to read. If this // register is written, the hardware expects a read or write operation // next. If a mass erase is requested instead, the mass erase will // fail. // if(ui32Count && (HWREG(EEPROM_EEOFFSET) == 0)) { HWREG(EEPROM_EEBLOCK) += 1; } } // // Clear the sector protection bits to prevent possible problems when // programming the main flash array later. // if(CLASS_IS_TM4C123 && REVISION_IS_A0) { _EEPROMSectorMaskClear(); } // // Return the current status to the caller. // return(HWREG(EEPROM_EEDONE)); }