2008-06-11 16:40:11     can't mount serial flash

Document created by Aaronwu Employee on Aug 7, 2013
Version 1Show Document
  • View in full screen mode

2008-06-11 16:40:11     can't mount serial flash

Larry Samuels (UNITED STATES)

Message: 57041   

 

I am using the uClinux 2008R1-RC8 Release.

 

I cannot mount a serial Flash that is CFI compliant.

 

The command set is equivalent to m25p80.

 

It is a 64 MBit part.

 

My custom board has 64 MB RAM, 4 MB Parallel NOR Flash (same as BF537-EZKIT)

 

Processor is BF534.

 

I have enabled all menu configurations as per enablling jffs2 wiki document.

 

When linux loads, I get:

 

Creating 4 MTD partitions on "physmap-flash.0":

0x00000000-0x00020000 : "Bootloader"

0x00020000-0x00120000 : "Kernel"

0x00120000-0x00400000 : "RootFS"

0x003f0000-0x00400000 : "MAC Address"

block2mtd: version $Revision: 3544 $

bfin5xx_spi_probe  r5

m25p80 spi0.7: m25p64 (8192 Kbytes)

Creating 3 MTD partitions on "m25p80":

0x00000000-0x00040000 : "bootloader"

0x00040000-0x00120000 : "kernel"

0x00120000-0x00800000 : "file system"

bfin-spi bfin-spi.0: Blackfin BF5xx on-chip SPI Contoller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

 

I belive the probe does see the Serial Flash using the m25p80 driver.

 

When I issue eraseall commands, the SPI clock, MOSI and Chip selects properly run.

 

When I try to eraseall, I get

 

root:/> eraseall /dev/mtd4

 

Erasing 64 Kibyte @ 0 --  0 % complete.

eraseall: /dev/mtd4: MTD Erase failure: Input/output error

 

Erasing 64 Kibyte @ 10000 -- 25 % complete.

eraseall: /dev/mtd4: MTD Erase failure: Input/output error

 

Erasing 64 Kibyte @ 20000 -- 50 % complete.

eraseall: /dev/mtd4: MTD Erase failure: Input/output error

 

Erasing 64 Kibyte @ 30000 -- 75 % complete.

eraseall: /dev/mtd4: MTD Erase failure: Input/output error

 

Erased 256 Kibyte @ 0 -- 100% complete.     

root:/>

 

Trying to mount, I get

 

root:/> mount -t jffs2 /dev/mtd4 /mnt

mount: mounting /dev/mtd4 on /mnt failed

 

Please direct me how to troubleshoot the issue.  I can provide more info when requested.

 

I don't know of any commands to read the ID of the Serial Flash Chip.  I recieve the correct Id message when I program using VISUAL DSP with no operating system.

 

Thank you.

 

 

QuoteReplyEditDelete

 

 

2008-06-12 03:47:33     Re: can't mount serial flash

Mike Frysinger (UNITED STATES)

Message: 57064   

 

serial flashes do not use CFI, so i dont know how yours code possibly be CFI compliant

 

please tell us the exact part number instead of referring to it indirectly

QuoteReplyEditDelete

 

 

2008-06-12 12:34:44     Re: can't mount serial flash

Larry Samuels (UNITED STATES)

Message: 57163   

 

Mike,

 

  I'm sorry, the parallell NAND Flash on my board is CFI compliant.

 

The Serial Flash is INTEL QH25F640S33B8.  It is a SPI interface part, the SPI command set looks compatible to the M25P80-VMP6T from ST, although my part is 64 MBit.

 

Thanks

QuoteReplyEditDelete

 

 

2008-06-12 13:24:07     Re: can't mount serial flash

Mike Frysinger (UNITED STATES)

Message: 57172   

 

afaik, there is no such thing as parallel NAND ... perhaps you meant parallel NOR ?

 

i dont think i have any parts like that around, so i cant really test it ... you'd have to enable debugging in the spi mtd driver and see where it's going wrong

QuoteReplyEditDelete

 

 

2008-06-13 08:30:14     Re: can't mount serial flash

Larry Samuels (UNITED STATES)

Message: 57233   

 

Mike

 

  In order to troubleshoot the m25p80 driver, I would like to compile it as a module.  I know how to copy the module to the target and run it.  How do you get the probe procedure to run?  Will I see a device that I can open? Or must I debug as a built-in driver and let uClinux when it starts up probe the device and monitor it this way?  That would mean I can only monitor the probing during startup.  Please give me more specifics on how to debug the probing of the device (to see it's ID), and debugging the erase command.

 

Larry

 

 

QuoteReplyEditDelete

 

 

2008-06-13 15:22:23     Re: can't mount serial flash

Mike Frysinger (UNITED STATES)

Message: 57262   

 

the probe procedure runs automatically when appropriate platform resources exist for your board in your board resources file.  the bf537-stamp declares resources that work for the m25p80 part, so you should b e able to look at that board's resources.

 

after the module loads, you access it like normal: through the mtd device nodes that appear in /dev/

QuoteReplyEditDelete

 

 

2008-06-20 15:27:16     Re: can't mount serial flash

Larry Samuels (UNITED STATES)

Message: 57643   

 

Mike,

 

  I have been able to update the uboot driver for spi flash and get my Intel S33 flash to erase, write and read. I know my hardware is good.  I use the same driver as the m25p80, but I had to add acommand to the spi_flash.c file to unprotect the sectors (sending command 01 followed by 0 to clear out the write bits in the status register).

 

  I am attempting to do that in the linux driver, namely m25p80.c  I found that I am not reading the status regiser correctly.  This led me to add printk statements to montior the dirver.  My system has m25p80 driver using the spi_bfin5xx device driver specified in the board file stamp.c. I configured linux to build spi_bfin5xx and m25p80 as modules (creating .ko files).

 

I can modprobe m25p80 and spi_bfin5xx. Then I issue eraseall /dev/mtd4. The command runs but indicates failure to erase. Using my printk statements I notice that the status regiser always read 0xff. The SPI sequence to read the SR should be CS Low, transmit 0x05, clockout out dummy byte while reading in SR, CS High.  Using my oscilloscope I notice CS goes high in between the 2 bytes.  Further debugging reveals the spi_bfin5xx uses a task scheduler, and schedules a u8_writer for 0x05 and a u8_reader for the dummy byte.  Scheduling 2 transfers (half duplex) causes CS to go high in between.

 

You must have tested the m25p80 - are you using the spi_bfin5xx as the spi driver? What does the CS do on your board? Should I write a driver from scratch or is there another direction to take?

 

Thanks again.

QuoteReplyEditDelete

 

 

2008-06-30 22:30:40     Re: can't mount serial flash

Mike Frysinger (UNITED STATES)

Message: 58140   

 

the m25p80 driver works fine -- with the devices we've tested.  i hooked up a logic analyzer to a m25p128 and it was able to read the jedec id / status register just fine (and the CS stayed low).  just had to change the .type field in the bf537-stamp boards file to match my part.

 

if you need an atomic transaction, then you need to use an atomic SPI sequence.  doing something like spi_write(); spi_read(); is never guaranteed to work.  the spi document gives an overview and points to files in the kernel tree which documents the api:

http://docs.blackfin.uclinux.org/doku.php?id=spi

Attachments

    Outcomes