我使用FAL操作外部的w25q128flash,最开始写入8个字节测试,写入和读出的内容都一致
后面我加大了写入的内容,加大到512字节,发现写入读出内容不同,我怀疑是打印问题于是对写入和读出的内容进行CRC验证,结果还是不同
于是我一步一步缩减写入的字节数,直到写入的内容到32字节,还是出现写入读出内容不同的现象
请问这块是有什么配置的问题么(已确定和栈空间无关,操作的线程栈空间开了4096)
附上相关代码
- void testFalWR(void)
- {
- uint8_t testWrite[320] = { 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00,
- 0xa8, 0xf3, 0x01, 0x20, 0x99, 0xc2, 0x00, 0x00, 0x71, 0x9b, 0x01, 0x00, 0x7d, 0xc3, 0x00, 0x00};
- uint8_t testRead[320] = {0};
- uint8_t TestWrite[8] = {0x01, 0x03, 0x05, 0x07, 0x02, 0x04, 0x06, 0x08};
- uint8_t TestRead[8] = {0};
- volatile uint16_t res = 0;
- static uint16_t CRC_Temp = 0;
- static uint16_t CRC_Read = 0;
- static uint8_t crc_h = 0xff;
- static uint8_t crc_l = 0xff;
- static const struct fal_partition *part_dev = NULL;
- static const struct fal_flash_dev *flash_dev = NULL;
- //flash_dev = fal_flash_device_find("upgrade");
- part_dev = fal_partition_find("upgrade");
- if(part_dev != NULL)
- {
- DEBUG_LOG("#####################rnfind fal partition######################rn");
- DEBUG_LOG("Probed a flash partition | %s | flash_dev: %s | offset: %ld | len: %d |.n",
- part_dev->name, part_dev->flash_name, part_dev->offset, part_dev->len);
- res = fal_partition_write(part_dev, 0x00, testWrite, 64);
- CRC_Temp = GetCRC16_User((unsigned char *)testWrite, 64, crc_h, crc_l);
- DEBUG_LOG("#####################rnFAL write %d Byte,crc is 0x%02x######################rn", res, CRC_Temp);
- res = 0;
- res = fal_partition_read(part_dev, 0x00, testRead, 64);
- CRC_Read = GetCRC16_User((unsigned char *)testRead, 64, crc_h, crc_l);
- int i = 0;
- DEBUG_LOG("#####################rnFAL read %d Byte crc is 0x%02x:######################rn", res, CRC_Read);
- }
- }
0
|
|
|
|
|
|