5 Replies Latest reply on Mar 16, 2016 5:16 AM by if

    How to use uart1 on MCU?

    if

      I need to catch serial data with tight timing, so I tried to solve it with the MCU.

      However I cannot find a way to activate UART1 (Arduino board pins 0 and 1, or /dev/ttyMFD1 in linux).

      Edison yocto and libs were updated a week ago.

      I tried:


      if(uart_setup(1, 115200))

           host_send((unsigned char*)"uart access problem\r\n", 22);

      else

           host_send((unsigned char*)"uart ok\r\n", 10);

       

      ...which prints the OK message, showing that the serial unit is initialized. Then in an infinite loop, once in every second:

       

          char text[11] = "0123456789";

           uart_write(1, (unsigned char*)text, 10);

       

      But no output on UART1 TX (pin1) at all. I checked it with the oscilloscope and it is flat 0V.

      I countertested the pins with a C++ program on the Atom processor, and the output works then.

       

      Is there anything else to be done to access UART1? Is this output actually UART1?

      (The definition of the serial communication lines is very vague, one has to gather the units, names and pins from junk.)

      It would be a very elegant solution with the built-in Quark MCU, but if I cannot crack it, I'll have to add an Atmel AtxMega, which seems a bit redundant.

      Any help would be highly appreciated.

        • 1. Re: How to use uart1 on MCU?
          Intel_Alvarado

          Hi,

           

          Are you using the Eclipse provided with the MCU SDK?

          Are you using the Arduino expansion board or the mini breakout board? If you are using the Arduino board you can see a guide on how to load MCU SDK scripts to your board here Installing the MCU SDK | Intel® Developer Zone . You can download the scripts in the download page here IoT - Intel® Edison Board Download | Intel® Developer Zone .

          I checked the code and it seems to be correct. Is there any chance you can upload the sample code for UART Using the MCU SDK and API: Code examples | Intel® Developer Zone and follow steps 3 through 7?

           

          Let me know your results.

           

          Sergio

          • 2. Re: How to use uart1 on MCU?
            if

            Thank you, Sergio.

             

            I use the MCU SDK Eclipse, and the Arduino breakout board. My SDK had been downloaded from the link you recommended. I remember, had tried the sample code too, but now I retested it again. If I installed the original source, it would work, and the hello mcu messages would appear on the operator consol.

            However if I changed uart number from 2 to 1, nothing would appear on the arduino edison shield connector 1TX-> . (Checked with an oscilloscope.)

             

            Here is how I have modified the above sample code to uart 1, and one second (only to see it does not work):

             

            #include "mcu_api.h"

            #include "mcu_errno.h"

            /*

            * This program sends a string to UART2 every 3 seconds

            */

            void mcu_main()

            {

                /* your configuration code starts here */

                uart_setup(1, 115200);


                while (1)

                {

                    uart_write(1, (unsigned char*)"hello mcu\r\n", 11);

                    mcu_sleep(100);

                }

            }

             

            I think the problem is about uart1. I may misunderstand what pins it belongs to, but from the bits and pieces it all seems to me it should be connected to shield connector 0 and 1.

             

            I must admit, I couldn't find solid documentation in this regard, so this is where I might be wrong. I got stuck here.

             

            Are there any means to access these uart pins by mcu? If not, is there any TTL level serial connection accessible by mcu at all? 

            Unfortunately due to the strict timing I cannot use an USB-RS232 converter.

            • 3. Re: How to use uart1 on MCU?
              Intel_Alvarado

              Setup the muxing using the attached script. The script from http://downloadmirror.intel.com/24910/eng/init_UART1.sh is missing the setup of gpio214.

               

              Let us know your results.

               

              Sergio

              • 4. Re: How to use uart1 on MCU?
                Intel_Alvarado

                Did you find our last suggestion helpful? Do you still need assistance with this thread?

                 

                Sergio

                • 5. Re: How to use uart1 on MCU?
                  if

                  Dear Sergio,

                  In the meantime I had to apply an extra MCU (AVRxmega), because the project had to proceed. I need another chance to return back to my original installation, but I am about to test this feature all the way down.

                  Sorry for being idle, but work is first.

                  Thank you,

                  Istvan