You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/12/03 01:10:04 UTC

[GitHub] [incubator-nuttx] yjdwbj opened a new pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

yjdwbj opened a new pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464


   Fixed: SDIO Interface hanging after inserted SD Card.
   
   ## Summary
     Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.
     Fixed: SDIO Interface hanging after inserted SD Card.
   
     The originally `sam4s-xplained-pro:nsh` can running a `nsh shell` if have no SD Card inserted. But reboot every 5s. No driver for the MT29F2G on board.
      About the SD Card hanging problem . _Originally posted by @yjdwbj in https://github.com/apache/incubator-nuttx/issues/2276#issuecomment-735631494_ .  I found a suspicious function  `usleep(MMCSD_CLK_DELAY)` at `mmcsd/mmcsd_sdio.c:2780` and `mmcsd/mmcsd_sdio.c:2648`. Then I changed `up_udelay(MMCSD_CLK_DELAY)` replace to `usleep(MMCSD_CLK_DELAY)`, the hanging problem has gone.
   
    According to the `MT29F2G Data Sheet` and the `Atmel-11100K-ATARM-SAM4S-Datasheet_09-Jun-15.pdf`  write the driver for the MTD interface.  But the `mkfatfs` can only format it as `FAT16` not `FAT32`. I would love to know that someone who have the same `sam4s-xplained-pro` board to testing SD Card and Nand flash. If you have one and use these driver function , please give me a feedback.
   ## Impact
   
   ## Testing
   
   ```sh
   nsh> df                                                                                      
     Block  Number                                                                              
     Size   Blocks     Used Available Mounted on                                                
    16384    15611     2100     13511 /fat                                                      
        0        0        0         0 /proc                                                     
   nsh> mount -t vfat /dev/mtdblock0 /flash                                                     
   nsh> df                                                                                      
     Block  Number                                                                              
     Size   Blocks     Used Available Mounted on                                                
    16384    15611     2100     13511 /fat                                                      
    65536     4095        3      4092 /flash                                                    
        0        0        0         0 /proc                                                     
   nsh> cat /flash/test.txt                                                                     
   NuttX 10.0.0 9315fe21ed-dirty Dec  2 2020 21:24:31 arm sam4s-xplained-pro   
   ```
   
   hexdump context
   
   ```sh
   nsh> hexdump /dev/mtdblock0 count=256                                                        
   /dev/mtdblock0 at 00000000:                                                                  
   0000: eb 3c 90 4e 55 54 54 58 20 20 20 00 08 20 01 00 .<.NUTTX   .. ..                       
   0010: 02 00 02 00 00 f8 05 00 3f 00 ff 00 00 00 00 00 ........?.......                       
   0020: 00 00 02 00 00 00 29 00 00 00 00 20 20 20 20 20 ......)....                            
   0030: 20 20 20 20 20 20 46 41 54 31 36 20 20 20 0e 1f       FAT16   ..                       
   0040: be 5b 7c ac 22 c0 74 0b 56 b4 0e bb 07 00 cd 10 .[|.".t.V.......                       
   0050: 5e eb f0 32 e4 cd 16 cd 19 eb fe 54 68 69 73 20 ^..2.......This                        
   0060: 69 73 20 6e 6f 74 20 61 20 62 6f 6f 74 61 62 6c is not a bootabl                       
   0070: 65 20 64 69 73 6b 2e 20 20 50 6c 65 61 73 65 20 e disk.  Please                        
   0080: 69 6e 73 65 72 74 20 61 20 62 6f 6f 74 61 62 6c insert a bootabl                       
   0090: 65 20 66 6c 6f 70 70 79 20 61 6e 64 0d 0a 70 72 e floppy and..pr                       
   00a0: 65 73 73 20 61 6e 79 20 6b 65 79 20 74 6f 20 74 ess any key to t                       
   00b0: 72 79 20 61 67 61 69 6e 20 2e 2e 2e 0d 0a 00 00 ry again .......                       
   00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................                       
   00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................                       
   00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................                       
   00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534746018



##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2645,7 +2645,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       priv->widebus = true;
 
       SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_4BIT);
-      usleep(MMCSD_CLK_DELAY);
+      up_udelay(MMCSD_CLK_DELAY);

Review comment:
       Hmmm we will need to figure out why.  That will cause lots of issues. Does it hang forever or is it just too long/short?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj edited a comment on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj edited a comment on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738657045


   @btashton  According your mentioned maybe it's the tick timer problem.  I checked the originally `nsh config`, I found the `CONFIG_SYSTEMTICK_EXTCLK=y` as default.   Then I disable it. and using `usleep` command in `nsh shell` is ok.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
patacongo commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738804687


   > @yjdwbj the change to `up_udelay` is incorrect as I mentioned. The driver should be using `nxsig_usleep`. I understand that when you used the usleep command at the `nsh` this likely means there is an issue with the system tick timer. With out this fixed most of the system will not function.
   
   The only way that nxsig_usleep() would hang is because the timer interrupt is not occurring OR because a bad timeout value is provided.  There is no other explanation.
   
   Perhaps the timer interrupt is no enabled.  Perhaps you are calling nxsig_usleep() too early in the initialization sequence.  nxsig_usleep() CANNOT be called from the board initialization logic because that is too early; that is BEFORE the timer or the interrupt system has been initialized.
   
   The board initialization logic is called early in boot-up from __start().  The timer facility cannot be used until the OS has initialized, the interrupts have been initialized, and the timer has been initialized.  That happens a long time after board initialization; that happens when up_initialize() is called.
   
   Could that be the problem?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738652538


   > > You had also mentioned that the board resets several seconds after boot, this is likely because of the watchdog timer WTAUTO fuse. You might want to enable `CONFIG_WDT_DISABLE_ON_RESET` or enable `WDT_THREAD` (which it looks like is already enabled in the nsh configuration in master.
   > 
   > The originally `nsh` config is enable the `WDT`,  I don't know it's usefulness. But the board will auto reset by 5 seconds  after boot , and did this forever.let alone to handle SD Card initial. This issue I had have mentioned at [#2276 ](https://github.com/apache/incubator-nuttx/issues/2276#issue-739704580)
   
   This is all related. The watchdog thread does not work because sleeping does not work. 
   
   I would enable the `CONFIG_WDT_DISABLE_ON_RESET` that should stop the board from rebooting. 
   
   Then if you can use gdb to check if that function I mentioned is getting called we can figure out why the sleep is hanging. My guess is there is a clock configuration issue for this board.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738686402


   @btashton Hi, When  I disabled the `CONFIG_SYSTEMTICK_EXTCLK`, and keep the `CONFIG_WDT_DISABLE_ON_RESET=y` the board works is fine. Please to review this code again. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534742085



##########
File path: boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h
##########
@@ -93,6 +99,62 @@
 #  undef HAVE_HSMCI
 #endif
 
+/* MMC/SD minor numbers */
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+#  define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+#ifndef CONFIG_NSH_MMCSDSLOTNO
+#  define CONFIG_NSH_MMCSDSLOTNO 0
+#endif
+
+#if CONFIG_NSH_MMCSDSLOTNO != 0
+#  error SAM34 has only one MMC/SD slot (CONFIG_NSH_MMCSDSLOTNO)
+#  undef CONFIG_NSH_MMCSDSLOTNO
+#  define CONFIG_NSH_MMCSDSLOTNO 0
+#endif
+
+#define HSMCI_SLOTNO CONFIG_NSH_MMCSDSLOTNO
+#define HSMCI_MINOR  CONFIG_NSH_MMCSDMINOR
+
+/* Automounter.  Currently only works with HSMCI. */
+
+#if !defined(CONFIG_FS_AUTOMOUNTER) || !defined(HAVE_HSMCI)
+#  undef HAVE_AUTOMOUNTER
+#  undef CONFIG_SAM34_HSMCI_AUTOMOUNT
+#endif
+
+#ifndef CONFIG_SAM34_HSMCI_AUTOMOUNT
+#  undef HAVE_AUTOMOUNTER
+#endif
+
+#ifdef HAVE_AUTOMOUNTER
+#  ifdef CONFIG_SAM34_HSMCI_AUTOMOUNT

Review comment:
       Yes, I will removed it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534687712



##########
File path: boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
##########
@@ -56,7 +55,6 @@ CONFIG_NSH_STRERROR=y
 CONFIG_PIPES=y
 CONFIG_PREALLOC_MQ_MSGS=8
 CONFIG_PREALLOC_TIMERS=4
-CONFIG_PTHREAD_STACK_DEFAULT=4096

Review comment:
       Was this reduced for some reason?  I would expect the default to be fine for this configuration so I am actually fine with the change long as you have verified it.  Otherwise I would just leave this configuration alone.

##########
File path: boards/arm/sam34/sam4s-xplained-pro/src/sam_spi.c
##########
@@ -0,0 +1,210 @@
+/****************************************************************************
+ * boards/arm/sam34/sam4s-xplained-pro/src/sam_spi.c

Review comment:
       The original version of this file is from Greg which was granted to Apache, so we can update it to have the Apache header like you have in the other new files.

##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2645,7 +2645,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       priv->widebus = true;
 
       SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_4BIT);
-      usleep(MMCSD_CLK_DELAY);
+      up_udelay(MMCSD_CLK_DELAY);

Review comment:
       We should not be using up_delay here this will cause a busy loop that is bad for performance.  Instead we should be using `nxsig_usleep`  (the original `usleep` is also wrong).  If this breaks the functionality we will need to look into that more to see why this is not sleeping the correct amount.

##########
File path: boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h
##########
@@ -93,6 +99,62 @@
 #  undef HAVE_HSMCI
 #endif
 
+/* MMC/SD minor numbers */
+
+#ifndef CONFIG_NSH_MMCSDMINOR
+#  define CONFIG_NSH_MMCSDMINOR 0
+#endif
+
+#ifndef CONFIG_NSH_MMCSDSLOTNO
+#  define CONFIG_NSH_MMCSDSLOTNO 0
+#endif
+
+#if CONFIG_NSH_MMCSDSLOTNO != 0
+#  error SAM34 has only one MMC/SD slot (CONFIG_NSH_MMCSDSLOTNO)
+#  undef CONFIG_NSH_MMCSDSLOTNO
+#  define CONFIG_NSH_MMCSDSLOTNO 0
+#endif
+
+#define HSMCI_SLOTNO CONFIG_NSH_MMCSDSLOTNO
+#define HSMCI_MINOR  CONFIG_NSH_MMCSDMINOR
+
+/* Automounter.  Currently only works with HSMCI. */
+
+#if !defined(CONFIG_FS_AUTOMOUNTER) || !defined(HAVE_HSMCI)
+#  undef HAVE_AUTOMOUNTER
+#  undef CONFIG_SAM34_HSMCI_AUTOMOUNT
+#endif
+
+#ifndef CONFIG_SAM34_HSMCI_AUTOMOUNT
+#  undef HAVE_AUTOMOUNTER
+#endif
+
+#ifdef HAVE_AUTOMOUNTER
+#  ifdef CONFIG_SAM34_HSMCI_AUTOMOUNT

Review comment:
       These should all be defined in the board Kconfig like this `boards/arm/sama5/sama5d4-ek/Kconfig`
   Then all of the #define CONFIG_ can go away in this section.  This is an old style from before we had Kconfig

##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2777,7 +2777,7 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
   /* Select high speed MMC clocking (which may depend on the DSR setting) */
 
   SDIO_CLOCK(priv->dev, CLOCK_MMC_TRANSFER);
-  usleep(MMCSD_CLK_DELAY);
+  up_udelay(MMCSD_CLK_DELAY);

Review comment:
       Same issue.  We should not use up_udelay unless it is really needed and instead use nxsig_usleep.  There are cases for very small sleeps where this can be the only way, but 5ms for MMCSD_CLK_DELAY should not be a problem for using nxsig_usleep

##########
File path: .gitignore
##########
@@ -23,6 +23,7 @@
 *.sym
 *.wsp
 *~
+.vscode

Review comment:
       should be `/.vscode`  Normally I dont like to add IDE specific entries, but I see we already have one for eclipse (I also use vscode so I personally wont mind)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r536479037



##########
File path: atmel_sam4s_xplained_pro_config
##########
@@ -0,0 +1,1546 @@
+#

Review comment:
       You mean the `arch/arm/src/sam34/Kconfig`  file ?  But I'm not changed this file,What you mean the other file? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534734615



##########
File path: .gitignore
##########
@@ -23,6 +23,7 @@
 *.sym
 *.wsp
 *~
+.vscode

Review comment:
       Here is my wrong added, I will delete it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
patacongo commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738004729


   You should read drivers/mtd/README.txt.  There are issues with using NAND FLASH and any of the existing file systems in NuttX.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534733762



##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2777,7 +2777,7 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
   /* Select high speed MMC clocking (which may depend on the DSR setting) */
 
   SDIO_CLOCK(priv->dev, CLOCK_MMC_TRANSFER);
-  usleep(MMCSD_CLK_DELAY);
+  up_udelay(MMCSD_CLK_DELAY);

Review comment:
       I just already to test the `nxsig_usleep` as your mention to using.  But the result of is hanging like to using the `usleep`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738640112


   You had also mentioned that the board resets several seconds after boot, this is likely because of the watchdog timer WTAUTO fuse.  You might want to enable `CONFIG_WDT_DISABLE_ON_RESET`  or enable `WDT_THREAD` (which it looks like is already enabled in the nsh configuration in master.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738032633


   I need someone help, at the `arm-05` run testing report a lot of repeat info like below:
   
   ```sh
   HEAD detached at pull/2464/merge
   Changes not staged for commit:
     (use "git add <file>..." to update what will be committed)
     (use "git restore <file>..." to discard changes in working directory)
   	modified:   boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
   
   no changes added to commit (use "git add" and/or "git commit -a")
   ```
   Which one can give me a instruct to resolve this problem. Thanks.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r536259949



##########
File path: atmel_sam4s_xplained_pro_config
##########
@@ -0,0 +1,1546 @@
+#

Review comment:
       @yjdwbj Looks like the file slipped in by accident.  Can you remove it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534744734



##########
File path: boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
##########
@@ -56,7 +55,6 @@ CONFIG_NSH_STRERROR=y
 CONFIG_PIPES=y
 CONFIG_PREALLOC_MQ_MSGS=8
 CONFIG_PREALLOC_TIMERS=4
-CONFIG_PTHREAD_STACK_DEFAULT=4096

Review comment:
       Yeah I would prefer to take the defaults as you did, I just would want to make sure the enabled features still work.  If you can verify that I am happy to take this change.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r536259949



##########
File path: atmel_sam4s_xplained_pro_config
##########
@@ -0,0 +1,1546 @@
+#

Review comment:
       @yjdwbj Looks like the file snuck in.  Can you remove it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738657045


   @btashton  According your mentioned maybe it's the tick timer problem.  I checked the originally `nsh config`, I found the `CONFIG_SYSTEMTICK_EXTCLK=y` as default.  I found the `CONFIG_SYSTEMTICK_EXTCLK=y` as default. Then I disable it. and using `usleep` command in `nsh shell` is ok.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738852977


   @yjdwbj can you run sleep 10 on the nsh and measure that time to make sure it's at least approximately 10sec. I just want to make sure that the ticks duration is correct since you are selecting a different clock source. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534741562



##########
File path: boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
##########
@@ -56,7 +55,6 @@ CONFIG_NSH_STRERROR=y
 CONFIG_PIPES=y
 CONFIG_PREALLOC_MQ_MSGS=8
 CONFIG_PREALLOC_TIMERS=4
-CONFIG_PTHREAD_STACK_DEFAULT=4096

Review comment:
       Here is no reason, maybe  I see the other boards have not. like STM32F7 etc. As your mentioned that I will keep the value.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738011713


   > You should read drivers/mtd/README.txt. There are issues with using NAND FLASH and any of the existing file systems in NuttX.
   
   Yes, I know it's have these issues. even the `nxffs` and `smartfs`. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534918379



##########
File path: boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
##########
@@ -56,7 +55,6 @@ CONFIG_NSH_STRERROR=y
 CONFIG_PIPES=y
 CONFIG_PREALLOC_MQ_MSGS=8
 CONFIG_PREALLOC_TIMERS=4
-CONFIG_PTHREAD_STACK_DEFAULT=4096

Review comment:
       Removed line of  `CONFIG_PTHREAD_STACK_DEFAULT=4096` that  it not be affect the system. The `NuttX` give it default value is 2048.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534780697



##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2645,7 +2645,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       priv->widebus = true;
 
       SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_4BIT);
-      usleep(MMCSD_CLK_DELAY);
+      up_udelay(MMCSD_CLK_DELAY);

Review comment:
       Another quick useful test would be for you to run the sleep command from nsh.  That would give us some confidence that the context switching logic is working correctly.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534800356



##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2645,7 +2645,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       priv->widebus = true;
 
       SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_4BIT);
-      usleep(MMCSD_CLK_DELAY);
+      up_udelay(MMCSD_CLK_DELAY);

Review comment:
       Yeah. this is quick useful way. I running  `usleep 3` into the `nsh shell` , the result of  hanging forever , can't interrupt by `Ctrl+C`  unless press board reset button.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738869002


   > @yjdwbj can you run sleep 10 on the nsh and measure that time to make sure it's at least approximately 10sec. I just want to make sure that the ticks duration is correct since you are selecting a different clock source.
   
   Yeah, I test it , and  I am make sure that selecting a different  clock source is correct.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738914372


   Once you have removed the extra file this looks good.  Thanks for fixing that issue and adding the additional support.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton merged pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
btashton merged pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r536479037



##########
File path: atmel_sam4s_xplained_pro_config
##########
@@ -0,0 +1,1546 @@
+#

Review comment:
       You mean the `arch/arm/src/sam34/Kconfig`  file ?  But I'm not changed this file,What you mean the other file? 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534807929



##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2645,7 +2645,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       priv->widebus = true;
 
       SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_4BIT);
-      usleep(MMCSD_CLK_DELAY);
+      up_udelay(MMCSD_CLK_DELAY);

Review comment:
       Also I have another board like `nucleo-stm32l152re`. which it running the `usleep`  command is  fine.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on a change in pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on a change in pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#discussion_r534733637



##########
File path: drivers/mmcsd/mmcsd_sdio.c
##########
@@ -2645,7 +2645,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       priv->widebus = true;
 
       SDIO_CLOCK(priv->dev, CLOCK_SD_TRANSFER_4BIT);
-      usleep(MMCSD_CLK_DELAY);
+      up_udelay(MMCSD_CLK_DELAY);

Review comment:
       I just already to test the `nxsig_usleep` as your mention to using.  But the result of is hanging like to using the `usleep`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
acassis commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738041873


   > I need someone help, at the `arm-05` run testing report a lot of repeat info like below:
   > 
   > ```shell
   > HEAD detached at pull/2464/merge
   > Changes not staged for commit:
   >   (use "git add <file>..." to update what will be committed)
   >   (use "git restore <file>..." to discard changes in working directory)
   > 	modified:   boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
   > 
   > no changes added to commit (use "git add" and/or "git commit -a")
   > ```
   > 
   > Which one can give me a instruct to resolve this problem. Thanks.
   
   Please try to update your config:
   
   ./tools/refresh.sh --silent sam4s-xplained-pro:nsh


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738633399


   > > I need someone help, at the `arm-05` run testing report a lot of repeat info like below:
   > > ```shell
   > > HEAD detached at pull/2464/merge
   > > Changes not staged for commit:
   > >   (use "git add <file>..." to update what will be committed)
   > >   (use "git restore <file>..." to discard changes in working directory)
   > > 	modified:   boards/arm/sam34/sam4s-xplained-pro/configs/nsh/defconfig
   > > 
   > > no changes added to commit (use "git add" and/or "git commit -a")
   > > ```
   > > 
   > > 
   > > Which one can give me a instruct to resolve this problem. Thanks.
   > 
   > Please try to update your config:
   > 
   > ./tools/refresh.sh --silent sam4s-xplained-pro:nsh
   
   @acassis Thanks. I always think the new `config` need to refresh. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
patacongo commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738808771


   > 
   > 
   > @btashton Hi, When I disabled the `CONFIG_SYSTEMTICK_EXTCLK`, and keep the `CONFIG_WDT_DISABLE_ON_RESET=y` the board works is fine. Please to review this code again.
   
   CONFIG_SYSTEMTICK_EXTCLK=y would be sufficient to cause the problem.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yjdwbj commented on pull request #2464: Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.

Posted by GitBox <gi...@apache.org>.
yjdwbj commented on pull request #2464:
URL: https://github.com/apache/incubator-nuttx/pull/2464#issuecomment-738648836


   > You had also mentioned that the board resets several seconds after boot, this is likely because of the watchdog timer WTAUTO fuse. You might want to enable `CONFIG_WDT_DISABLE_ON_RESET` or enable `WDT_THREAD` (which it looks like is already enabled in the nsh configuration in master.
   
   The originally `nsh` config is enable the `WDT`,  I don't know it's usefulness. But the board will auto reset by 5 seconds  after boot , and did this forever.let alone to handle SD Card initial. This issue I had have mentioned at [#2276 ](https://github.com/apache/incubator-nuttx/issues/2276#issue-739704580)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org