RTS for UART1 and UART2

Started by zharry, November 17, 2019, 05:24:44 pm

Previous topic - Next topic

LubOlimex

Quote from: zharry on November 19, 2019, 03:50:22 pm
Quote from: zharry on November 19, 2019, 03:41:21 pmThis is all so confusing, is there a known working tutorial / howto / guide / anything on building custom kernel for olinuxino64?

Let me rephrase it - is there a guide on how exactly was this image:

ftp://staging.olimex.com/Allwinner_Images/a64-olinuxino/linux/1.latest_images/bionic/images/

built?


I believe we usually build it with:

git clone --branch olimex https://github.com/olimex/build

cd build

touch .ignore_changes

./compile.sh \
                        BRANCH=next \
                        BOARD=olinuxino-a64 \
                        USE_MAINLINE_GOOGLE_MIRROR=yes \
                        NO_APT_CACHER=yes \
                        WIREGUARD=no \
                        EXTRAWIFI=no
Technical support and documentation manager at Olimex

martinayotte

Quote from: zharry on November 19, 2019, 04:47:56 pmSorry, it's sunxi-uart.c not uart.c
I think you are mixing branches, this one still doesn't exist in Mainline, it is only in Legacy BSP 3.4.y, and this driver doesn't handle RS485 either ...

zharry

Quote from: LubOlimex on November 19, 2019, 04:50:59 pmI believe we usually build it with:

Code Select Expand
git clone --branch olimex https://github.com/olimex/build

cd build

touch .ignore_changes

./compile.sh \
                        BRANCH=next \
                        BOARD=olinuxino-a64 \
                        USE_MAINLINE_GOOGLE_MIRROR=yes \
                        NO_APT_CACHER=yes \
                        WIREGUARD=no \
                        EXTRAWIFI=no

Yes, thanks you, it works.

Quote from: martinayotte on November 20, 2019, 11:36:48 pmI think you are mixing branches, this one still doesn't exist in Mainline, it is only in Legacy BSP 3.4.y, and this driver doesn't handle RS485 either ...

Yes, I was trying to build the Armbian main branch. With the branch LubOlimex provided, I can build same kernel I have and it runs.

Now next question is how do I apply a patch to it? It seems that if I just patch by copying patch files next to drivers directory and running
patch -p1 < patchFile
directly files in build/cache/sources/linux-mainline/linux-5.2.y, driver is patched successfully, but when I run ./compile.sh it seems that the script cleans the patch files and changes to sources.

So is there some special place to put the patches or is there a parameter to use so the driver stays patched?

martinayotte

Quote from: zharry on November 23, 2019, 04:16:39 amSo is there some special place to put the patches
In the Armbian build tree, you simply need to place the patch under userpatches/kernel/sunxi-dev/

zharry

Done it. Took a while, patch, driver and build system documentation is a bit lacking or I'm just not used to open source. Anyway - with some tweaks to termios in c application 485 Works great after patching tyhe kernel with em485 patches, some lurking and some help from friends.

So first:

Quote from: martinayotte on November 23, 2019, 03:33:15 pmuserpatches/kernel/sunxi-dev/

No not exaclty. Seems they actually have to be in userpatches/kernel/sunxi-next-olinuxino. Well, at least that worked for me.

And 2nd - the patch files should end with *.patch or the build script will not find them.


So ToDo list for getting 485 working is:
1. Make new DTS remapping RTS pin to UART
2. Compile, apply DTS
3. Set up VM with Ubuntu
4. Use LubOlimex build instructions to get the toolchain
5. Save patches form kernel mailing list to *.patch files
6. Put patches in build patch folder
7. Build it with kernel only and switch
8. transfer *.deb to board
9. install *.deb and reboot
10. write the c app to use 485 features

Do you think there would be point in dropping my patches, test apps, DTS and notes to GitHub and make a detailed tutorial on this? Or nobody else is interested in it or everyone else knows how to do it already and there is no point spending a day to write that?