Antony Abi Rached Posted November 9, 2018 Posted November 9, 2018 Hello guys, I am trying to use hardware flow control over the uart 1 of a nanopi neo core that I am using with a minishield. The GPIO pins of RX,TX,RTS and CTS of uart 1 based on this documentation (http://wiki.friendlyarm.com/wiki/index.php/Mini_Shield_for_NanoPi_NEO_Core/Core2) are G6,G7,G8 and G9. First of all I downloaded WiringNP in order to see the status of each GPIO. Before activating the rts cts on uart1, the figure "beforeActivatingRTSCTS" is the output of the command "gpio readall" . Then I added to the /boot/armbianEnv.txt the following overlay : param_uart1_rtscts=1 I rebooted the nanopi. After reboot, the figure "AfterActivatingRTSCTS" is the output of the command "gpio readall". As you can see, the GPIOG9 switched to ALT5 but GPIOG8 stayed the same. I am supposing that the ALT5 is the Alternate function for RTS CTS. Is that right? Why the GPIOG8 didn't change to ALT5 after activating the RTS CTS ? Is there something that I am doing wrong to activate these pins? Do I need to instruct the serial port driver to use the hardware flow control signals? Thanks in advance. Regards, Antony
Antony Abi Rached Posted November 9, 2018 Author Posted November 9, 2018 Hello again, I tested the hardware flow control after adding "param_uart1_rtscts=1" to /boot/armbianEnv.txt. The CTS of the nanopi worked normally. (The GPIO mode of the CTS switched to ALT5). The RTS didn't work. (The GPIO mode of the RTS didn't switch to ALT5). I did the serial communication test between the nanopi and a raspberrypi. Why do you thing the RTS is not working? Thanks in advance. Regards, Antony
martinayotte Posted November 9, 2018 Posted November 9, 2018 44 minutes ago, Antony Abi Rached said: Why do you thing the RTS is not working? Are you trying to use RTS in a context for RS485 HalfDuplex operation ? If it is the case, Allwinner SoCs are using "dw-apb-uart" compatible, which doesn't suuport RS485 HalfDuplex operation ... However, I've made a patch which use "em485 emulator", but it is not publish yet, I wish to do additional testing first.
Antony Abi Rached Posted November 9, 2018 Author Posted November 9, 2018 Thanks for your reply @martinayotte. I am not using a RS485 halfduplex operation. I have two devices that are communicating using serial port (UART) and I would like to use hardware flow control because it is recommended for the communication that I am doing. The RTS and CTS in my case will help the two devices know if they are ready to send/receive data. What I am finding strange is that when I activate RTS and CTS, the mode function of the CTS GPIO only switch to ALT5. The RTS GPIO stays as "OUTPUT mode". Shouldn't the RTS GPIO switch also to ALT5? Regards, Antony
martinayotte Posted November 9, 2018 Posted November 9, 2018 1 minute ago, Antony Abi Rached said: Shouldn't the RTS GPIO switch also to ALT5 I think so ... Maybe another glitch in the "dw-apb-uart" driver ? I will try your scenario when I got chance, "time is always the missing ingredient" ...
Antony Abi Rached Posted November 9, 2018 Author Posted November 9, 2018 @martinayotte thanks again for the help. Regards, Antony
Antony Abi Rached Posted November 9, 2018 Author Posted November 9, 2018 @martinayotte I forgot to mention this information. I am using the following nanopi neo core image : Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14 The reason why I am using this image is using the SSD disk for file system with the SD card for boot. We already discussed this issue with you : Regards, Antony
Antony Abi Rached Posted November 9, 2018 Author Posted November 9, 2018 @martinayotte i just tested the hardware flow control with the newest armbian neo core image that i donwloaded today from the website. Both RTS and CTS worked with this image. So i have the following results with these two images: *Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14 : 1) hardware flow control doesn't work normally. 2) mount the file system on ssd disk and boot from sd card work normally. *Armbian_5.65_Nanopineo_Debian_stretch_next_4.14.14 : 1) hardware flow control work normally. 2) mount the file system on ssd disk and boot from sd card doesn't work normally. Hope I helped you with the tests that I did. Regards, Antony
martinayotte Posted November 9, 2018 Posted November 9, 2018 3 hours ago, Antony Abi Rached said: *Armbian_5.65_Nanopineo_Debian_stretch_next_4.14.14 : 1) hardware flow control work normally. 2) mount the file system on ssd disk and boot from sd card doesn't work normally. Glad to see that your RTS/CTS issue is fixed ... For the SSD rootfs, you can check again the mount point, having SSD /etc/fstab as clean as possible, removing /media/mmcboot for example, which seems the issue in your last Serial Log.
Antony Abi Rached Posted November 12, 2018 Author Posted November 12, 2018 Hello @martinayotte. I copied the /etc/fstab of the image that works in the /etc/fstab of the image that is not working. Then I changed the UUID of the corresponding disks (SSD and SD). It worked I can now use the new image of armbian and boot from SD and have the filesystem on rootfs. Thanks for the help again. Regards, Antony
JimmyK Posted December 15, 2018 Posted December 15, 2018 Hello @martinayotte. I see you mention that the Allwinner SoCs does not support half duplex? Did I mistake you? I have the Orange Pi Zero and I am attempting to repurpose UART2 as type 2 in order to free up RTS and CTS to use them as GPIO's. So far I cannot make this happen, and would like to know if this is not possible without something like the emulator you mentioned, or if I misunderstood you. I have all UART overlays enabled, and am pretty sure that UART2 is ttyS2. Thanks in advance! JimmyK On 11/9/2018 at 6:10 AM, martinayotte said: Are you trying to use RTS in a context for RS485 HalfDuplex operation ? If it is the case, Allwinner SoCs are using "dw-apb-uart" compatible, which doesn't suuport RS485 HalfDuplex operation ... However, I've made a patch which use "em485 emulator", but it is not publish yet, I wish to do additional testing first.
martinayotte Posted December 15, 2018 Posted December 15, 2018 10 hours ago, JimmyK said: I see you mention that the Allwinner SoCs does not support half duplex? Did I mistake you? I wasn't talking about hardware SoC itself, but the Linux "dw-apb-uart" kernel driver. If you are in hurry, your software application would need to set manually RTS high/low according to your data flow. If you are not in hurry, wait until I provide my "em485 emulator" patches to Armbian dev tree.
JimmyK Posted April 24, 2019 Posted April 24, 2019 On 12/15/2018 at 5:41 AM, martinayotte said: I wasn't talking about hardware SoC itself, but the Linux "dw-apb-uart" kernel driver. If you are in hurry, your software application would need to set manually RTS high/low according to your data flow. If you are not in hurry, wait until I provide my "em485 emulator" patches to Armbian dev tree. Have you by chance provided the "em485 emulator" patches to the Armbian dev tree? I will be getting back to this section of my project soon and if it's been patched please provide link. Thanks in advance! Jimmy
martinayotte Posted April 24, 2019 Posted April 24, 2019 12 hours ago, JimmyK said: Have you by chance provided the "em485 emulator" patches to the Armbian dev tree? Not yet ... But feel free to do your own build using the patch provided in attachment ... rs485-8250_dw.patch
Recommended Posts