diff --git a/configs/olimex-lpc1766stk/README.txt b/configs/olimex-lpc1766stk/README.txt index 361acc49f68..d20e14ac170 100644 --- a/configs/olimex-lpc1766stk/README.txt +++ b/configs/olimex-lpc1766stk/README.txt @@ -943,7 +943,7 @@ Configuration Sub-Directories In principle, Zmodem transfers could be performed on the any serial device, including the console device. However, only the LPC17xx UART1 supports hardware flow control which is required for Zmodem - trasnfers. Also, this configuration permits debug output on the + transfers. Also, this configuration permits debug output on the serial console while the transfer is in progress without interfering with the file transfer. @@ -1135,11 +1135,15 @@ Configuration Sub-Directories best thing to do would be to use the matching NuttX sz on the Linux host side. - 2013-7-16. More Testing against the NuttX rz/sz on Both Ends. + 2013-7-16. More Testing against the NuttX rz/sz on Both Ends. - The NuttX sz/rz commands have been modified so that they can be - built and executed under Linux. In this case, there are no - transfer problems at all in either direction and with large or - small files. This configuration could probably run at much higher - serial speeds and with much smaller buffers (although that has not - been verified as of this writing). + The NuttX sz/rz commands have been modified so that they can be + built and executed under Linux. In this case, there are no + transfer problems at all in either direction and with large or + small files. This configuration could probably run at much higher + serial speeds and with much smaller buffers (although that has not + been verified as of this writing). + + CONCLUSION: You really do need proper hardware flow control to + use zmodem. That is not currently implemented in the LPC17xx + family. diff --git a/configs/olimex-stm32-p407/README.txt b/configs/olimex-stm32-p407/README.txt index b4bdefe400c..909cc649fee 100644 --- a/configs/olimex-stm32-p407/README.txt +++ b/configs/olimex-stm32-p407/README.txt @@ -13,6 +13,8 @@ Contents o Board Support o microSD Card Interface o OTGFS Host + o Using NuttX Zmodem with a Linux Host + o Building the Zmodem Tools to Run Under Linux o Configurations Board Support @@ -230,6 +232,121 @@ OTGFS Host some logic issues, probably in drivers/usbhost/usbhost_hidkbd, with polling and data filtering. +Using NuttX Zmodem with a Linux Host +==================================== + + Sending Files from the Target to the Linux Host PC + -------------------------------------------------- + The NuttX Zmodem commands have been verified against the rzsz programs + running on a Linux PC. To send a file to the PC, first make sure that + the serial port is configured to work with the board (Assuming you are + using 9600 baud for the data transfers -- high rates may result in data + overruns): + + $ sudo stty -F /dev/ttyS0 9600 # Select 9600 BAUD + $ sudo stty -F /dev/ttyS0 crtscts # Enables CTS/RTS handshaking * + $ sudo stty -F /dev/ttyS0 # Show the TTY configuration + + * Only is hardware flow control is enabled. + + Start rz on the Linux host (using /dev/ttyS0 as an example): + + $ sudo rz /dev/ttyS0 + + You can add the rz -v option multiple times, each increases the level + of debug output. If you want to capture the Linux rz output, then + re-direct stderr to a log file by adding 2>rz.log to the end of the + rz command. + + NOTE: The NuttX Zmodem does sends rz\n when it starts in compliance with + the Zmodem specification. On Linux this, however, seems to start some + other, incompatible version of rz. You need to start rz manually to + make sure that the correct version is selected. You can tell when this + evil rz/sz has inserted itself because you will see the '^' (0x5e) + character replacing the standard Zmodem ZDLE character (0x19) in the + binary data stream. + + If you don't have the rz command on your Linux box, the package to + install rzsz (or possibily lrzsz). + + Then on the target (using /dev/ttyS1 as an example). + + > sz -d /dev/ttyS1 + + Where filename is the full path to the file to send (i.e., it begins + with the '/' character). /dev/ttyS1 or whatever device you select + *MUST* support Hardware flow control in order to throttle therates of + data transfer to fit within the allocated buffers. + + Receiving Files on the Target from the Linux Host PC + ---------------------------------------------------- + NOTE: There are issues with using the Linux sz command with the NuttX + rz command. See "Status" below. It is recommended that you use the + NuttX sz command on Linux as described in the next paragraph. + + To send a file to the target, first make sure that the serial port on the + host is configured to work with the board (Assuming that you are using + 9600 baud for the data transfers -- high rates may result in data + overruns): + + $ sudo stty -F /dev/ttyS0 9600 # Select 9600 (or other) BAUD + $ sudo stty -F /dev/ttyS0 crtscts # Enables CTS/RTS handshaking * + $ sudo stty -F /dev/ttyS0 # Show the TTY configuration + + * Only is hardware flow control is enabled. + + Start rz on the on the target. Here, in this example, we are using + /dev/ttyS1 to perform the transfer + + nsh> rz -d /dev/ttyS1 + + /dev/ttyS1 or whatever device you select *MUST* support Hardware flow + control in order to throttle therates of data transfer to fit within the + allocated buffers. + + Then use the sz command on Linux to send the file to the target: + + $ sudo sz /dev/ttyS0 + + Where is the file that you want to send. + + The resulting file will be found where you have configured the Zmodem + "sandbox" via CONFIG_SYSTEM_ZMODEM_MOUNTPOINT. + + You can add the sz -v option multiple times, each increases the level + of debug output. If you want to capture the Linux rz output, then + re-direct stderr to a log file by adding 2>az.log to the end of the + rz command. + + If you don't have the az command on your Linux box, the package to + install rzsz (or possibily lrzsz). + +Building the Zmodem Tools to Run Under Linux +============================================ + + Build support has been added so that the NuttX Zmodem implementation + can be executed on a Linux host PC. This can be done by + + - Change to the apps/systems/zmodem directory + - Make using the special makefile, Makefile.host + + NOTES: + + 1. TOPDIR and APPDIR must be defined on the make command line: TOPDIR is + the full path to the nuttx/ directory; APPDIR is the full path to the + apps/ directory. For example, if you installed nuttx at + /home/me/projects/nuttx and apps at /home/me/projects/apps, then the + correct make command line would be: + + make -f Makefile.host TOPDIR=/home/me/projects/nuttx APPDIR=/home/me/projects/apps + + 2. Add CONFIG_DEBUG_FEATURES=1 to the make command line to enable debug output + 3. Make sure to clean old target .o files before making new host .o files. + + This build is has been verified as of 2013-7-16 using Linux to transfer + files with an Olimex LPC1766STK board. It works great and seems to solve + all of the problems found with the Linux sz/rz implementation. + Configurations ============== @@ -413,6 +530,29 @@ must be is one of the following. CONFIG_EXAMPLES_SOTEST_DEVMINOR=1 CONFIG_EXAMPLES_SOTEST_DEVPATH="/dev/ram1" + zmodem: + + This configuration was used to test the zmodem utilities at apps/system/zmodem. Two serial ports are used in this configuration: + + 1. USART6 (RS232_1) is the serial console (because it does not support hardware flow control). + 2. USART3 (RS232_2) is the zmodem port and does require that hardware flow control be enabled for use. + + General usage instructions: + + [on target] + 1. nsh> mount -t vfat /dev/sda /mnt + + [on Linux host] + $ sudo stty -F /dev/ttyS0 9600 + $ sudo stty -F /dev/ttyS0 crtscts + $ sudo stty -F /dev/ttyS0 + + [on target] + nsh> rz + + [on host] + $ sudo sz doarm.sh /dev/ttyS0 + STATUS ====== diff --git a/configs/olimex-stm32-p407/include/board.h b/configs/olimex-stm32-p407/include/board.h index 7a26575b6d0..adf228fa449 100644 --- a/configs/olimex-stm32-p407/include/board.h +++ b/configs/olimex-stm32-p407/include/board.h @@ -310,10 +310,21 @@ * if we set aside more DMA channels/streams. * * SDIO DMA - * DMAMAP_SDIO_1 = Channel 4, Stream 3 - * DMAMAP_SDIO_2 = Channel 4, Stream 6 + * DMAMAP_SDIO_1 = Channel 4, Stream 3 + * DMAMAP_SDIO_2 = Channel 4, Stream 6 */ #define DMAMAP_SDIO DMAMAP_SDIO_1 +/* USART6 + * + * DMAMAP_USART6_RX_1 = Channel 5, Stream1 + * DMAMAP_USART6_RX_2 = Channel 5, Stream2 + * DMAMAP_USART6_TX_1 = Channel 5, Stream6 + * DMAMAP_USART6_TX_2 = Channel 5, Stream7 + */ + +#define DMAMAP_USART6_RX DMAMAP_USART6_RX_1 +#define DMAMAP_USART6_TX DMAMAP_USART6_TX_1 + #endif /* __CONFIGS_OLIMEX_STM32_P407_INCLUDE_BOARD_H */ diff --git a/configs/olimex-stm32-p407/zmodem/defconfig b/configs/olimex-stm32-p407/zmodem/defconfig new file mode 100644 index 00000000000..2e4711376f4 --- /dev/null +++ b/configs/olimex-stm32-p407/zmodem/defconfig @@ -0,0 +1,74 @@ +# CONFIG_ARCH_FPU is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="olimex-stm32-p407" +CONFIG_ARCH_BOARD_OLIMEX_STM32P407=y +CONFIG_ARCH_CHIP_STM32=y +CONFIG_ARCH_CHIP_STM32F407ZG=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_DISABLE_POLL=y +CONFIG_EXAMPLES_NSH=y +CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_I2C=y +CONFIG_I2C_POLLED=y +CONFIG_I2C_RESET=y +CONFIG_I2S=y +CONFIG_INTELHEX_BINARY=y +CONFIG_MAX_TASKS=16 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MM_REGIONS=2 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=16 +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_SERIAL_IFLOWCONTROL_LOWER_WATERMARK=25 +CONFIG_SERIAL_IFLOWCONTROL_UPPER_WATERMARK=75 +CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS=y +CONFIG_SERIAL_TERMIOS=y +CONFIG_SPI=y +CONFIG_START_DAY=26 +CONFIG_START_MONTH=5 +CONFIG_STM32_CCMEXCLUDE=y +CONFIG_STM32_FLOWCONTROL_BROKEN=y +CONFIG_STM32_JTAG_SW_ENABLE=y +CONFIG_STM32_OTGFS=y +CONFIG_STM32_PWR=y +CONFIG_STM32_USART3=y +CONFIG_STM32_USART6=y +CONFIG_SYSTEM_ZMODEM=y +CONFIG_SYSTEM_ZMODEM_DEVNAME="/dev/ttyS1" +CONFIG_SYSTEM_ZMODEM_IFLOW=y +CONFIG_SYSTEM_ZMODEM_MOUNTPOINT="/mnt" +CONFIG_SYSTEM_ZMODEM_OFLOW=y +CONFIG_SYSTEM_ZMODEM_RCVBUFSIZE=1024 +CONFIG_USART3_BAUD=9600 +CONFIG_USART3_IFLOWCONTROL=y +CONFIG_USART3_OFLOWCONTROL=y +CONFIG_USART3_RXBUFSIZE=512 +CONFIG_USART6_SERIAL_CONSOLE=y +CONFIG_USBHOST=y +CONFIG_USBHOST_ISOC_DISABLE=y +CONFIG_USBHOST_MSC=y +CONFIG_USER_ENTRYPOINT="nsh_main"