Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12596 Discussions

Problem accessing all available NOR flash memory running uCLinux

Altera_Forum
Honored Contributor II
1,102 Views

Hi, 

 

I kindly request for your expertise to help me with this issue. I have been stuck with this problem about couple weeks already and have search and tried multiple suggestions but still no luck. This includes tried with the latest Linux driver. I have a custom board with a 128MByte NOR flash memory 16 bit databus Part:PC28F00AP33TFA, and am having trouble to access the entire memory. The uClinux was able to detect the NOR flash memory by printing this message: "20000000.flash: Found 1 x32 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000089 Chip ID 0x008966" 

Intel/Sharp Extended Query Table at 0x010A 

Intel/Sharp Extended Query Table at 0x010A 

Intel/Sharp Extended Query Table at 0x010A 

Intel/Sharp Extended Query Table at 0x010A 

Using buffer write method 

Using auto-unlock on power-up/resume 

cfi_cmdset_001: Erase suspend on write enabled 

erase region 0: offset=0x0,size=0x20000,blocks=1023 

erase region 1: offset=0x7fe0000,size=0x8000,blocks=4 

 

I know it know it understand there is 128MB because when I "cat /proc/mtd", the mtd0 size reported back is 08000000, which about 134MB, and detected erasesize is 00020000. However, when everything seems to be okay, I tried to "flash_eraseall -j /dev/mtd0", I get error(s): 

Erasing 128Kibyte@ 0 -0% complete.20000000.flash: buffer write error (status 0xb0) 

flash_eraseall: /dev/mtd0: short write 

 

Not to mention, I can't mount my chip to mtdblock0:( I am using device tree (dts) configuration and am not sure if I missed anything? 

 

The following is my setup: 

 

In Qsys "Generic Tri-State Controller" setting: address width:27, data width:16, Byteenable width:2, Byte per word:2 

Top level HDL: 

output wire [25:0] flash_address, 

inout reg [15:0] flash_data, 

wire [26:0] addr_internal; 

assign flash_address = addr_internal[26:1]; 

 

In uClinux menuconfig:  

Device driver--> <*>Memory Technology Device (MTD) support-->  

<*> Command line partition table parsing 

<*>Openfirmware partitioning information support 

<*>Direct char device access to MTD devices 

-*- Common interface to block layer for MTD 'translation layers' 

<*> Caching block device access to MTD devices 

RAM/ROM/Flash chip drivers--> 

<*> Detect flash chips by Common Flsah Interface (CFI) probe 

[*] Flash chip driver advanced configuration options (Flash cmd/query data swapping (NO) 

[*] Specific CFI Flash gemometry selection 

[*] Support 8-bit buswidth 

[*] Support 16-bit buswidth 

[*] Support 1-chip flash interleave 

[*] Support 2-chip flash interleave 

<*> Support for Intel/Sharp flash chips 

 

Mapping drivers for chip access --> 

<*> Flash device in physical memory map based on OF description //I disabled the Flash device in physical memory map 

 

In device tree: 

flash: flash@0x0 { 

compatible ="ALTR,cfi_flash-13.1", "cfi-flash"; 

reg =< 0x00000000 0x08000000 >; 

bank-width = < 2 >; 

device-width = < 1 >; 

}; 

 

The NOR memory works only if I access half of the memory (67MByte). No erase error or read/write problem, and mounted successful. The only different is configuration of the HDL address bus is 26 bits instead of 27 as following: 

In Qsys "Generic Tri-State Controller" setting: address width:26, data width:16, Byteenable width:2, Byte per word:2 

Top level HDL: 

output wire [25:0] flash_address, 

inout reg [15:0] flash_data, 

wire [25:0] addr_internal; 

assign flash_address = {1'b0, addr_internal[25:1]}; 

 

Any help is greatly appreciated:)
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
372 Views

Hi, 

 

Days have gone by and I had tried several things but still no luck of resolving this issue. With this part I'm seeing MTD errors that I think I've traced to cfi_cmdset_0001.c that I'd like to ask about. I removed the commented CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE and CMDSET0001_DISABLE_WRITE_SUSPEND in cfi_cmdset_0001.c, but the result is the same "buffer write error (status 0xb0)". According to the datasheet, 0xb0 means program or erase suspend. I am able to flash_eraseall /dev/mtd0 without the "-j" clean marker, but when I tried to flash_eraseall -j /dev/mtd0, it gives me the same error. why?
0 Kudos
Reply