nxfss on MT25Q nor flash
Does anyone have any pointers on how to setup nxfss (or any filesystem for that matter) on an MT25Q nor flash? I cannot find any code for any other boards that makes any sense to me and I feel this should be a pretty basic thing to want to do? I believe I have set up all the SPI stuff and now need to (auto)mount it in my bringup or app init code, but I'm stuck :( "CONFIG_HAVE_M25P" is as far as I have got. SAMA5D27 device. TIA, Tim.
Re: nxfss on MT25Q nor flash
Hi Tim, It seams like MT25Q uses the m25px.c driver, so I assume you are enabling the CONFIG_MT25Q_MEMORY_TYPE right? Next you need to configure our board SPI CS pin, please take a look at: arm/stm32/mikroe-stm32f4/src/stm32_spi.c Then before try to setup the NXFFS you need to confirm that the Flash NOR was detected correctly. BR, Alan On 8/24/21, Tim wrote: > Does anyone have any pointers on how to setup nxfss (or any filesystem for > that matter) on an MT25Q nor flash? > > > > I cannot find any code for any other boards that makes any sense to me and > I > feel this should be a pretty basic thing to want to do? I believe I have > set > up all the SPI stuff and now need to (auto)mount it in my bringup or app > init code, but I'm stuck :( > > > > "CONFIG_HAVE_M25P" is as far as I have got. > > > > SAMA5D27 device. > > > > TIA, > > > > Tim. > > > >
RE: nxfss on MT25Q nor flash
>From: Alan Carvalho de Assis > >It seams like MT25Q uses the m25px.c driver, so I assume you are enabling the >CONFIG_MT25Q_MEMORY_TYPE right? Yes = my .config has CONFIG_MT25Q_MEMORY_TYPE set > >Next you need to configure our board SPI CS pin, please take a look >at: arm/stm32/mikroe-stm32f4/src/stm32_spi.c > Yes, I have defined the PIOs etc. >Then before try to setup the NXFFS you need to confirm that the Flash NOR was >detected correctly. How, in code or from the nsh, do I do that? I know the chip works as I've used it (for example) for u-boot environment variables with no issue, but I can't find the way to either mount it, or "probe" it, or anything, from nuttx. It doesn’t appear as a /dev. No doubt it's in some documentation somewhere > >On 8/24/21, Tim wrote: >> Does anyone have any pointers on how to setup nxfss (or any filesystem >> for that matter) on an MT25Q nor flash? >> >> >> >> I cannot find any code for any other boards that makes any sense to me >> and I feel this should be a pretty basic thing to want to do? I >> believe I have set up all the SPI stuff and now need to (auto)mount it >> in my bringup or app init code, but I'm stuck :(
Re: nxfss on MT25Q nor flash
Hi Tim, On 8/24/21, Tim wrote: >>From: Alan Carvalho de Assis >> >>It seams like MT25Q uses the m25px.c driver, so I assume you are enabling >> the >>CONFIG_MT25Q_MEMORY_TYPE right? > > Yes = my .config has CONFIG_MT25Q_MEMORY_TYPE set > >> >>Next you need to configure our board SPI CS pin, please take a look >>at: arm/stm32/mikroe-stm32f4/src/stm32_spi.c >> > > Yes, I have defined the PIOs etc. > >>Then before try to setup the NXFFS you need to confirm that the Flash NOR >> was >>detected correctly. > > How, in code or from the nsh, do I do that? I know the chip works as I've > used it (for example) for u-boot environment variables with no issue, but I > can't find the way to either mount it, or "probe" it, or anything, from > nuttx. It doesn’t appear as a /dev. > > No doubt it's in some documentation somewhere > You can enable the CONFIG_DEBUG_FS_* to see the mtd debug messages. It will tell you want is going on. BR, Alan
RE: nxfss on MT25Q nor flash
Hi Alan, >Hi Tim, > >On 8/24/21, Tim wrote: >> >>>Then before try to setup the NXFFS you need to confirm that the Flash >>>NOR was detected correctly. >> >> How, in code or from the nsh, do I do that? I know the chip works as >> I've used it (for example) for u-boot environment variables with no >> issue, but I can't find the way to either mount it, or "probe" it, or >> anything, from nuttx. It doesn’t appear as a /dev. >> > >You can enable the CONFIG_DEBUG_FS_* to see the mtd debug messages. It will >tell you want is going on. > Yes, I have done that of course, but get no messages. I am sure this is simply because there is no code being called to register the driver as I can't find an example for any other boards that looks relevant :(
Re: nxfss on MT25Q nor flash
Ok, did you open your System.map and searched for m25p_initialize() ? Few days ago I gave someone else this same tip (and another) and he got things working, please take a look on our email history. BR, Alan On 8/24/21, Tim wrote: > Hi Alan, > >>Hi Tim, >> >>On 8/24/21, Tim wrote: >>> Then before try to setup the NXFFS you need to confirm that the Flash NOR was detected correctly. >>> >>> How, in code or from the nsh, do I do that? I know the chip works as >>> I've used it (for example) for u-boot environment variables with no >>> issue, but I can't find the way to either mount it, or "probe" it, or >>> anything, from nuttx. It doesn’t appear as a /dev. >>> >> >>You can enable the CONFIG_DEBUG_FS_* to see the mtd debug messages. It >> will >>tell you want is going on. >> > Yes, I have done that of course, but get no messages. I am sure this is > simply because there is no code being called to register the driver as I > can't find an example for any other boards that looks relevant :( > >
Re: nxfss on MT25Q nor flash
> but I can't find the way to either mount it, or "probe" it, or anything, from nuttx. The sequence to initialise the flash and mount NXFFS should look like the following (to be adapted for chip and device): spi = stm32_spibus_initialize(1); if (!spi) { ferr("ERROR: Failed to initialize SPI port 2\n"); return -ENODEV; } mtd = w25_initialize(spi); if (!mtd) { ferr("ERROR: Failed to bind SPI port 2 to the SST 25 FLASH driver\n"); return -ENODEV; } ret = nxffs_initialize(mtd); if (ret < 0) { ferr("ERROR: NXFFS initialization failed: %d\n", -ret); return ret; } ret = nx_mount(NULL, "/mnt", "nxffs", 0, NULL); if (ret < 0) { ret = nx_mount(NULL, "/mnt", "nxffs", 0, "forceformat"); if (ret < 0) { ferr("ERROR: Failed to mount the FS volume: %d\n", errno); return ret; } } On Tue, Aug 24, 2021 at 6:39 PM Tim wrote: > Hi Alan, > > >Hi Tim, > > > >On 8/24/21, Tim wrote: > >> > >>>Then before try to setup the NXFFS you need to confirm that the Flash > >>>NOR was detected correctly. > >> > >> How, in code or from the nsh, do I do that? I know the chip works as > >> I've used it (for example) for u-boot environment variables with no > >> issue, but I can't find the way to either mount it, or "probe" it, or > >> anything, from nuttx. It doesn’t appear as a /dev. > >> > > > >You can enable the CONFIG_DEBUG_FS_* to see the mtd debug messages. It > will > >tell you want is going on. > > > Yes, I have done that of course, but get no messages. I am sure this is > simply because there is no code being called to register the driver as I > can't find an example for any other boards that looks relevant :( > >
Re: nxfss on MT25Q nor flash
BTW, do we have a driver for MT25Q? I can't see one. Is it compatible with the M25P series? On Tue, Aug 24, 2021 at 5:50 PM Abdelatif Guettouche < abdelatif.guettou...@gmail.com> wrote: > > but I can't find the way to either mount it, or "probe" it, or anything, > from nuttx. > > > The sequence to initialise the flash and mount NXFFS should look like the > following (to be adapted for chip and device): > > spi = stm32_spibus_initialize(1); > if (!spi) > { > ferr("ERROR: Failed to initialize SPI port 2\n"); > return -ENODEV; > } > > mtd = w25_initialize(spi); > if (!mtd) > { > ferr("ERROR: Failed to bind SPI port 2 to the SST 25 FLASH > driver\n"); > return -ENODEV; > } > > ret = nxffs_initialize(mtd); > if (ret < 0) > { > ferr("ERROR: NXFFS initialization failed: %d\n", -ret); > return ret; > } > > ret = nx_mount(NULL, "/mnt", "nxffs", 0, NULL); > if (ret < 0) >{ >ret = nx_mount(NULL, "/mnt", "nxffs", 0, "forceformat"); >if (ret < 0) > { > ferr("ERROR: Failed to mount the FS volume: %d\n", errno); > return ret; > } >} > > > On Tue, Aug 24, 2021 at 6:39 PM Tim wrote: > >> Hi Alan, >> >> >Hi Tim, >> > >> >On 8/24/21, Tim wrote: >> >> >> >>>Then before try to setup the NXFFS you need to confirm that the Flash >> >>>NOR was detected correctly. >> >> >> >> How, in code or from the nsh, do I do that? I know the chip works as >> >> I've used it (for example) for u-boot environment variables with no >> >> issue, but I can't find the way to either mount it, or "probe" it, or >> >> anything, from nuttx. It doesn’t appear as a /dev. >> >> >> > >> >You can enable the CONFIG_DEBUG_FS_* to see the mtd debug messages. It >> will >> >tell you want is going on. >> > >> Yes, I have done that of course, but get no messages. I am sure this is >> simply because there is no code being called to register the driver as I >> can't find an example for any other boards that looks relevant :( >> >>
RE: nxfss on MT25Q nor flash
No, it's not in the system map. Having now searched for it I see there's a possibly useful example in stm32_appinit.c so I will wade through that. How was I supposed to know what to look for!!?? >Ok, did you open your System.map and searched for m25p_initialize() ? > >Few days ago I gave someone else this same tip (and another) and he got things >working, please take a look on our email history. > >BR, > >Alan >
Re: nxfss on MT25Q nor flash
Hi Tim, It is not your fault, it is fault to NuttX complexity. We need to improve it, I think NSH_ARCHINIT should be enabled by default. NuttX is full of unnecessary traps that let users to fall into all the time. BR, Alan On 8/24/21, Tim wrote: > No, it's not in the system map. Having now searched for it I see there's a > possibly useful example in stm32_appinit.c so I will wade through that. > > How was I supposed to know what to look for!!?? > >>Ok, did you open your System.map and searched for m25p_initialize() ? >> >>Few days ago I gave someone else this same tip (and another) and he got >> things >>working, please take a look on our email history. >> >>BR, >> >>Alan >> > >
Re: nxfss on MT25Q nor flash
that is the best and usual way to get documentation about nuttx you need some grep-fu the system.map trick is a generic debug technique that you can't invent if someone else doesnt tell you about it :) sebastien Le 24/08/2021 à 18:57, Tim a écrit : No, it's not in the system map. Having now searched for it I see there's a possibly useful example in stm32_appinit.c so I will wade through that. How was I supposed to know what to look for!!?? Ok, did you open your System.map and searched for m25p_initialize() ? Few days ago I gave someone else this same tip (and another) and he got things working, please take a look on our email history. BR, Alan
RE: nxfss on MT25Q nor flash
There is support for MT25Q128 and I have now added the MT25Q256 It is in nuttx/drivers/mtd/m25px.c and I will add to the list of PRs once I have everything sorted on my board. Subject: Re: nxfss on MT25Q nor flash BTW, do we have a driver for MT25Q? I can't see one. Is it compatible with the M25P series?
Re: nxfss on MT25Q nor flash
My board is now correctly registering the SPI instance and binding the relevant SPI and CS to the SPI Flash driver. It was an uphill struggle, but thanks to all your various suggestions I have got there and learned more than I wanted to! Next hurdle is to trawl through other boards to learn how to "automount" my SPI flash as a file system - maybe SMART or maybe MXFSS; right now, any file system mounting from my board or app init function would be good :) On 24/08/2021 16:53, Alan Carvalho de Assis wrote: Hi Tim, It seams like MT25Q uses the m25px.c driver, so I assume you are enabling the CONFIG_MT25Q_MEMORY_TYPE right? Next you need to configure our board SPI CS pin, please take a look at: arm/stm32/mikroe-stm32f4/src/stm32_spi.c Then before try to setup the NXFFS you need to confirm that the Flash NOR was detected correctly. BR, Alan On 8/24/21, Tim wrote: Does anyone have any pointers on how to setup nxfss (or any filesystem for that matter) on an MT25Q nor flash? I cannot find any code for any other boards that makes any sense to me and I feel this should be a pretty basic thing to want to do? I believe I have set up all the SPI stuff and now need to (auto)mount it in my bringup or app init code, but I'm stuck :( "CONFIG_HAVE_M25P" is as far as I have got. SAMA5D27 device. TIA, Tim.
Re: nxfss on MT25Q nor flash
Hi Tim, Congratulations! We are happy to see your progress with NuttX. If you want to help future "Tim"s please right a small documentation about it. You can create it at: Documentation/guides/eeprom_spi.rst BR, Alan On 8/25/21, Tim Hardisty wrote: > My board is now correctly registering the SPI instance and binding the > relevant SPI and CS to the SPI Flash driver. > > > It was an uphill struggle, but thanks to all your various suggestions I > have got there and learned more than I wanted to! > > Next hurdle is to trawl through other boards to learn how to "automount" > my SPI flash as a file system - maybe SMART or maybe MXFSS; right now, > any file system mounting from my board or app init function would be good > :) > > On 24/08/2021 16:53, Alan Carvalho de Assis wrote: >> Hi Tim, >> >> It seams like MT25Q uses the m25px.c driver, so I assume you are >> enabling the CONFIG_MT25Q_MEMORY_TYPE right? >> >> Next you need to configure our board SPI CS pin, please take a look >> at: arm/stm32/mikroe-stm32f4/src/stm32_spi.c >> >> Then before try to setup the NXFFS you need to confirm that the Flash >> NOR was detected correctly. >> >> BR, >> >> Alan >> >> On 8/24/21, Tim wrote: >>> Does anyone have any pointers on how to setup nxfss (or any filesystem >>> for >>> that matter) on an MT25Q nor flash? >>> >>> >>> >>> I cannot find any code for any other boards that makes any sense to me >>> and >>> I >>> feel this should be a pretty basic thing to want to do? I believe I have >>> set >>> up all the SPI stuff and now need to (auto)mount it in my bringup or app >>> init code, but I'm stuck :( >>> >>> >>> >>> "CONFIG_HAVE_M25P" is as far as I have got. >>> >>> >>> >>> SAMA5D27 device. >>> >>> >>> >>> TIA, >>> >>> >>> >>> Tim. >>> >>> >>> >>> >
Re: nxfss on MT25Q nor flash
s/right/write/ Sorry for the typo On 8/25/21, Alan Carvalho de Assis wrote: > Hi Tim, > > Congratulations! We are happy to see your progress with NuttX. > > If you want to help future "Tim"s please right a small documentation about > it. > > You can create it at: > > Documentation/guides/eeprom_spi.rst > > BR, > > Alan > > On 8/25/21, Tim Hardisty wrote: >> My board is now correctly registering the SPI instance and binding the >> relevant SPI and CS to the SPI Flash driver. >> >> >> It was an uphill struggle, but thanks to all your various suggestions I >> have got there and learned more than I wanted to! >> >> Next hurdle is to trawl through other boards to learn how to "automount" >> my SPI flash as a file system - maybe SMART or maybe MXFSS; right now, >> any file system mounting from my board or app init function would be good >> :) >> >> On 24/08/2021 16:53, Alan Carvalho de Assis wrote: >>> Hi Tim, >>> >>> It seams like MT25Q uses the m25px.c driver, so I assume you are >>> enabling the CONFIG_MT25Q_MEMORY_TYPE right? >>> >>> Next you need to configure our board SPI CS pin, please take a look >>> at: arm/stm32/mikroe-stm32f4/src/stm32_spi.c >>> >>> Then before try to setup the NXFFS you need to confirm that the Flash >>> NOR was detected correctly. >>> >>> BR, >>> >>> Alan >>> >>> On 8/24/21, Tim wrote: Does anyone have any pointers on how to setup nxfss (or any filesystem for that matter) on an MT25Q nor flash? I cannot find any code for any other boards that makes any sense to me and I feel this should be a pretty basic thing to want to do? I believe I have set up all the SPI stuff and now need to (auto)mount it in my bringup or app init code, but I'm stuck :( "CONFIG_HAVE_M25P" is as far as I have got. SAMA5D27 device. TIA, Tim. >> >