9 Replies Latest reply on Sep 23, 2014 5:03 PM by omeier

    Linux : Where is UART's

    slasson

      Hi,

      I have installed Linux in the RiotBoard.

      i would like use UART's in Expansion Port (UART3, UART4 and UART5)

       

      I have found :

      - UART3 on / dev/ttymxc2

      - Debug port on /dev/ttymxc1

       

      I don't know where is connected /dev/ttymxc0 and search others Serial port : UART4 & 5

        • Re: Linux : Where is UART's
          czudekm

          Hello,

           

          Today I was trying to connect my two RS485 to RiotBoard but I'm stuck were you are. I was able to connect one RS485 to UART3 (ttymxc2), but I can't see UART4 & 5 and ttymxc0 seems to be not connect to neither of them.

           

          In dmesg is just this about Serial IMX drivers:

          Serial: IMX driver
          imx-uart.0: ttymxc0 at MMIO 0x2020000 (irq = 58) is a IMX
          imx-uart.1: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX
          console [ttymxc1] enabled, bootconsole disabled
          console [ttymxc1] enabled, bootconsole disabled
          imx-uart.2: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX
          

           

          So if anyone knows how to make it working I will be very glad.

          • Re: Linux : Where is UART's
            linxdev

            I'm interested in the UARTS myself.  I need RS232 support with CTS,RTS,DCD,and DTR.  Are these UARTS TTL or RS232 levels?  Is there support for the hardware control signals?

             

            Thanks,

            Chris

              • Re: Linux : Where is UART's
                slasson

                i don't found support with CTS,RTS,DCD,and DTR (maybe by GPIO)

                 

                however, I can confirm that the signal level is TTL for all UART

                  • Re: Linux : Where is UART's
                    czudekm

                    Hello,

                     

                    Finaly I foud a solution to make UART 4&5 working.

                    I will try to write simple guide, how to achieve that.

                     

                    Thanks to xizhou wang I was able to find the way how to do that.

                     

                    1. In schematics http://www.element14.com/community/servlet/JiveServlet/previewBody/65504-102-1-287949/RIoTboard_Schematics.pdf on page 8 you can find how the UART 4&5 are pinned.  

                     

                    So in file /linux-imx/arch/arm/mach-mx6/board-mx6dl_riot.h you have to add UART4&5

                     

                    #if 0
                            /* UART1 for debug */
                            MX6DL_PAD_CSI0_DAT10__UART1_TXD,
                            MX6DL_PAD_CSI0_DAT11__UART1_RXD,
                    #else
                            /* UART2 for debug */
                            MX6DL_PAD_EIM_D26__UART2_TXD,
                            MX6DL_PAD_EIM_D27__UART2_RXD,
                    #endif
                            /* UART3 */
                            MX6DL_PAD_EIM_D24__UART3_TXD,
                            MX6DL_PAD_EIM_D25__UART3_RXD,
                    
                            /********************** ADDED ***********************/
                            /* UART4 */
                            MX6DL_PAD_KEY_COL0__UART4_TXD,
                            MX6DL_PAD_KEY_ROW0__UART4_RXD,
                    
                            /* UART5 */
                            MX6DL_PAD_KEY_COL1__UART5_TXD,
                            MX6DL_PAD_KEY_ROW1__UART5_RXD,
                            /***************************************************/
                    

                           

                    2. Then in /linux-imx/arch/arm/mach-mx6/board-mx6q_riot.c you have to initialize UART 4&5

                     

                    static inline void mx6q_riot_init_uart(void)
                    {
                            imx6q_add_imx_uart(0, NULL);
                            imx6q_add_imx_uart(1, NULL);
                            imx6q_add_imx_uart(2, NULL);
                             
                    /********************** ADDED ***********************/
                            imx6q_add_imx_uart(3, NULL);
                            imx6q_add_imx_uart(4, NULL);
                    /***************************************************/
                    }
                    

                     

                    And now you have to recompile the kernel and flash it to your RiotBoard.

                    After that you will have:

                     

                    /dev/ttymxc0 - still don't know what is for

                    /dev/ttymxc1 - debug serial port

                    /dev/ttymxc2 - UART3

                    /dev/ttymxc3 - UART4

                    /dev/ttymxc4 - UART5

                     

                    Hope it will help

                      • Re: Linux : Where is UART's

                        Marek Czudek wrote:

                         

                        /dev/ttymxc0 - still don't know what is for

                        it's hooked up to the OpenSDA debugger via U26 on p20 of the schematics.  Some info on OpenSDA is available here https://www.pemicro.com/opensda/ and the user guide http://cache.freescale.com/files/32bit/doc/user_guide/OPENSDAUG.pdf

                         

                        It's briefly mentioned on p33 of the user manual with the note at the bottom of the page that says

                        The RIoTboard has hardware to support Freescale’s OpenSDA interface. Currently this

                        interface has not been enabled in software

                        so apparently ttymxc0 is unusable as the OpenSDA hardware appears to be the only way to get to it and for some unknown reason it has no software support.

                         

                        Indeed, following the instructions from the OpenSDA user manual gets no response. No usb storage device appears. You'd have to assume therefore that whatever firmware is supposed to be loaded onto the Kinetis K20 is missing.  Only a guess, but loading it may take jtag onto the un-populated J17.

                        • Re: Linux : Where is UART's
                          slasson

                          do you have tutorial to rebuild kernel linux for riotboard  ? or just image binary file included UART 4 & 5 ?

                            • Re: Linux : Where is UART's
                              radiatortwo

                              Here is how I compiled the older RiotBoard Kernel from the git Repo. Everthing done in a Debian Virtual Machine.

                              I don´t use the toolchain from the repos. because of that you have to install some essential stuff.

                               

                              apt-get install git build-essential fakeroot kernel-package u-boot-tools zlib1g-dev libncurses5-dev
                              
                              

                               

                              To get the gcc compiler with armhf put this line into /etc/apt/sources.list

                              deb http://www.emdebian.org/debian/ unstable main
                              
                              

                               

                              Then type the following commands:

                              apt-get update
                              apt-get install emdebian-archive-keyring
                              apt-get update
                              apt-get install gcc-4.7-arm-linux-gnueabihf
                              ln -sf `which arm-linux-gnueabihf-gcc-4.7 ` /usr/local/bin/arm-linux-gnueabihf-gcc
                              
                              

                               

                              Now you can checkout the Kernel code from git

                              git clone git://github.com/embest-tech/linux-imx.git -b embest_imx_3.0.35_4.1.0
                              
                              

                               

                              At this point you can make the changes as described in this thread to activate UART 4 & 5.

                               

                              Then to configure and compile everything.

                              cd linux-imx
                              make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_defconfig
                              make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage
                              
                              

                               

                              If it compiles without errors you find the images under arch/arm/boot

                               

                              Tell me please if I missed something or you get any errors.

                              I´ve written this directly out of my head. So it could be wrong in some point.

                              1 of 1 people found this helpful
                                • Re: Linux : Where is UART's
                                  jimt57

                                  Otto, thank you for your instructions. It was very helpful and much appreciated. Much better than using the toolchain. However, the symbolic link didn't work for me (using Debian 7.5 VM) and I had to change it to:

                                   

                                  ln -sf arm-linux-gnueabihf-gcc-4.7 /usr/bin/arm-linux-gnueabihf-gcc

                                   

                                  Just in case others are having the same problems I did. After that everything worked great, not only for the original kernel but also for selsinork's new u-boot and kernel. (Thank you selsinork!).

                        • Re: Linux : Where is UART's
                          omeier

                          Hello,

                           

                          I try to read/write to the UART3 on /dev/ttymxc2, but I dont get any signals on the expansion port (Pin 26 & 28).

                          I use a C library and I also try it in the console:

                               stty -F /dev/ttymxc2 cs8 -cstopb 115200

                               echo Hello world > /dev/ttymxc2

                          -> There is no error, just nothing seems to happen


                          If I do the same on /dev/ttymxc1 (debug port), transmit works fine (with C-Librarry and console commands).

                          I can not receive data on /dev/ttymxc1, but I think this is OK because the console parses the rx data.


                          So why is /dev/ttymxc2 not working?

                          -> Do I have to do some additional configuration to use UART3?

                           

                           

                          Thanks,

                          Oliver