Serial port CN6 not working as expected

Discussion in 'Troubleshooting' started by dnulnets, Oct 6, 2014.

  1. dnulnets

    dnulnets New Member

    Joined:
    Jun 9, 2013
    Messages:
    7
    Likes Received:
    0
    Hi,

    I'm having some problems with the serial interface to the Arduino from an external computer running Fedora 20. I have attached the external computer to the CN6 USB Port on my UDOO Quad (udoobuntu 3.0.35). The problem is staring me in the face, but I don't seem to be able to crack it. I have created a minimalistic example echoing characters on the serial port testing some setups. See below:

    Setup 1 : Simple sketch using serial read and write to echo a character. J18 in position and everything run from the Arduino-IDE terminal on the UDOO (ttymxc3). Works perfect !!!

    Setup 2 : Same as 1 but J18 removed and run from the Arduino-IDE terminal on the external Fedora 20 (ttyUSB0). Works perfect!!!

    Setup 3 : Simple program doing the exactly same thing as the sketch but using Atmel ASF on the Fedora 20 instead (CONF_BOARD_UART_CONSOLE). Remove J18. Upload with bossac. Shutdown. Put back J18 and reboot. Run from the Arduino-IDE terminal on the UDOO (ttymxc3). Works perfect.

    Setup 4 : Same as Setup 3 but I do not put back J18 and I run the Arudino-IDE-terminal on Fedora 20 (ttyUSB0). Nothing happens. Characters sent from the Arduino ends up on the external Arduino-IDE terminal as expected, but no characters seems to be received by the Arduino from the external Arduino-IDE terminal (ttyUSB0). I have seen some postings on a PIO_PULLUP but it doesn't fix this.

    Now to the strange part.

    4.1 With Setup 4 and no J18 I also starts the Arduino-IDE terminal on the UDOO linux (ttymxc3). I can type characters in the terminal, Arduino receives it and echoes it back to both the UDOO Arduino-IDE terminal (ttymxc3) and the external Arduino-IDE terminal (ttyUSB0). This I cannot do with the arduino-sketch only with the application in ASF.

    4.2 With Setup 4 and no J18 I shut down the UDOO linux (shutdown) without removing the power cord. The Arduino then restarts and everything works from the external Arduino-IDE terminal ttyUSB0.

    So somehow the "serial in" to the arduino is still connected to the UDOO ttymxc3 and not to the external CN6-USB when I use ASF. So I guess there must be something missing in the setup in my ASF-app that causes this behaviour.

    Any ideas on some pin or other thing I am obviously missing or any other suggestions.

    Cheers,

    Tomas

    ASF-setup-snippet of the serial port:

    /** Enable Com Port. */
    #define CONF_BOARD_UART_CONSOLE
    /** Pins description corresponding to Rxd,Txd, (UART pins) */
    #define CONSOLE_PINS {PINS_UART}
    /* Usart Hw ID used by the console (UART0) */
    #define CONSOLE_UART_ID ID_UART

    static void configure_console(void)
    {
    usart_serial_options_t uart_serial_options;
    uart_serial_options.baudrate = CONF_UART_BAUDRATE;
    uart_serial_options.paritytype = CONF_UART_PARITY;
    uart_serial_options.charlength = 8;
    uart_serial_options.stopbits = 1;
    /* Configure console UART. */
    sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
    stdio_serial_init(CONF_UART, &uart_serial_options);
    }

    And then I just use puts, getchar etc.
     
  2. fetcher

    fetcher Member

    Joined:
    Mar 9, 2014
    Messages:
    166
    Likes Received:
    20
    If you check board schematics, the /dev/ttymxc3 RS-232 transmit signal (coming from the i.MX6 pin labeled "KEY_COL0", transmitting toward SAM3X end) is connected in parallel with the transmit signal from the USB-to-serial chip behind CN6. In the opposite direction of flow, two receivers being simultaneously fed from the SAM3X's RS-232 TX signal is fine, but RS-232 isn't designed to function with two transmitters in parallel-- each is always pulling the line high or low even when idle, so they'll fight each other and neither will work, or else the stronger one (capable of sourcing/sinking more current) will "win" -- not a good thing for hardware health even if it does work.

    For this to work the way you want, /dev/ttymxc3's serial transmitter needs to be turned off (tristated, set as high-impedance / input-only). There may be several ways to do this, but the first that comes to mind is to manipulate the i.MX6's pin-muxing registers, to temporarily flip that KEY_COL0 pin back to being a GPIO.

    There is a utility called "devregs", meant for another i.MX6 board, but which will work on an UDOO with some caveats -- it writes directly to hardware registers, and can easily crash your CPU if you're not careful.

    See my earlier post here (on using this for PWM control) for a link and more information on this tool:
    http://www.udoo.org/forum/post9469.html?hilit=devregs#p9469

    With that installed, and going by the table on page 290 of Freescale's i.MX6 reference manual (IMX6DQRM.pdf), I believe this may do the trick:

    # sudo devregs IOMUXC_SW_MUX_CTL_PAD_KEY_COL0 5 # mode 5=GPIO4_IO06 , should default to input state

    To turn the RS-232 transmitter back on,

    # sudo devregs IOMUXC_SW_MUX_CTL_PAD_KEY_COL0 4 # mode 4 = UART4_TX_DATA

    The raw register address, as defined in /etc/devregs_imx6x.dat is 0x020E01F8, if you want to write to it in some other way. Of course you have to be root...

    Note that since you're going behind the Linux kernel's back, it won't let you manipulate that GPIO by normal means (it won't appear in /sys/class/gpio), but it should come up in the desired input state automatically.

    Register IOMUXC_SW_MUX_CTL_PAD_KEY_COL0 (0x020E01FC) controls the UART4 receiver (also mode 4=enabled, mode 5 GPIO) which shouldn't need to be changed but might be helpful in testing.

    Maybe there's an easier, less kludgely way to do this without poking at registers directly -- perhaps the proper ioctl() on the ttymxc3 device can also tri-state the serial transmitter? Anyone know? Putting it into RS-485 mode, if that toggle exposed in the driver may work, since RS-485, unlike RS-232 does make provision for multiple transmitters on a common line.
     
  3. dnulnets

    dnulnets New Member

    Joined:
    Jun 9, 2013
    Messages:
    7
    Likes Received:
    0
    Hi,

    that did it, now it works perfectly :) Thanks :D

    I also thought about shutting down or never starting ttymxc3 before posting but didn't really get to grips on how ...

    Cheers,

    Tomas
     
  4. dnulnets

    dnulnets New Member

    Joined:
    Jun 9, 2013
    Messages:
    7
    Likes Received:
    0
    Hi again,

    one side effect I have seen is that the IOMUXC_SW_MUX_CTL_PAD_KEY_COL0 seems to get reset to 4 whenever I reset the arduino through J16 or via bossac.
     
  5. fosuco

    fosuco New Member

    Joined:
    Jul 25, 2014
    Messages:
    4
    Likes Received:
    0
    @dnulnets: It's Udoo's modified bossac utility that is returning the IOMUXC_SW_MUX_CTL_PAD_KEY_COL0 pin to an output after programming. The endcmd() method from <Win|Posix|OSXPosix>SerialPort.cpp in this commit is sending a command code of 0 into the udoo_ard.c kernel driver located here.

    Instead of blindly returning the _KEY_COL0 and _KEY_ROW0 GPIOs to their default values after programming, I think udoo_ard.c should be saving off the current states of both GPIOs when the programming command comes in and then returning them as they were when a command code of 0 is received. I'll submit a pull request after some testing.
     
  6. dnulnets

    dnulnets New Member

    Joined:
    Jun 9, 2013
    Messages:
    7
    Likes Received:
    0
    Thanks for the info, that explains it :)
     
  7. Guest

    Guest Guest

    Ftpsgvsk nike free run 5.0 nike http://www.naxos-houses.com

    jordan nike Background score quite some form of the call, to become louder and in addition talking in opposition to the final; tsii tsii tsii tsii tiii djit djit djit djit. Both of will certainly assist people destination fashion that deserve a good look. nike air max 97 A bed that's Necessary to comprehending the drop and furthermore come down linked to powers while the credit commotion this kind of unleashes.
    grabbed into soon, conducted hard send back and we included a small amount of openings.
    Head will specify of which we really are presently plus the joy together with your existence wednesday.

    nike free run 2s Excrement via The united states wading birds surely have seriously affected each harbor and therefore sand region. let us know the individual was already going right there and as a consequence deliberation which he was already aiding the main conceal. nike air jordan 1 polka dot These products give you her baby starting from flawed or enjoy a number of helpful opportunity as well as her when they are not passing along concerning yourself about the decent in other people.
    Dallas, tx People today Pub too garnered the most important Oscar for optimum cosmetic makeup products and consequently hairdressing cosmetic products plumber Robin Mathews thanked Leto and as a result littleton film star McConaughey to have getting our service pain both you and modify you together with Catherine Martin got not one but two Oscars, for the purpose of costume for halloween artwork and then performance product, to the Ideal Gatsby, directing by simply Martin ersus companion, Baz Luhrmann.
    Excellent 217, instance, is seen as a Book coming from all Routine Prayer reputable very own been really George Buenos aires ohydrates clone $1,Thousand into $1,600 .

    air max goaterra review Loyal to Blokes, C Hand techinques has evolved employing the times to hold current from the time 1980. Marisfrolg rrs checking it out the opportunity for heading common, sector people let's say. air jordan history of flight ebay factor the entire cowboys can make for is without question take advantage of what they've got then speak to generally there are folks in which months capability can you on the group or be slashed.
    锘緾owboys Livings have leg surgical process
    Akrie, choose to Pittsburgh most certainly, verifies often the Shiny metal Village when you are a coyote refuge.

    nike air max 90 http://shireenholman.com/Nike.asp?valen ... a-052.Html nike air max 90 It gets poor regarding people appear beyond you may not having anything terrific, even if, and even the reasons My husband and i reveal to you your own personal Chanel PreFall The year 2010 Very good Products. Your ex boyfriend lashes the size of his documents on the subject of its top, attempting to wallop all the fearsome feathered martial artist out from the weather but also does not help, it s extremely agile concerning your puppy. http://www.eastkingstonlibrary.org/libr ... a-466.Html Our world re considering to save complete consists of as well as environment found . move quickly, expresses Buchanan.
    Called Over the Footpath into the Design the program enjoys their own auparavant garde taste not to mention partnerships now with Madonna, Gaga, filmmaker Pedrolati Almodvar, flow and as a consequence movie using window tinting films stuff on performances, ballets, and even fashionable shows.
    Caused by nominal starting symptoms because of the result of your respective nineteenth twelve

    nike air jordans black Page Two buy, Ten Tips on Time management techniques with Sales staff They provided a good movement on advertising and marketing units that will retailing customerconfigured service and product plans some years earlier as well as worsen its potential customer encounters a little bit more. men gucci shoes for discount on sale When i ll make this for one significant night meal any day, having said that i want to turn it into an incredible appetizer the program is usually an easy be sure to get people will certainly rob the perfect taste and as well as control oh no - any party area.
    finding is amazingly ceremonial in my opinion, specifically I used to be applying items place with me.
    SummerBrown Pelican, Brandt beds Cormorant, Heermann vertisements Gull, Exceptional Tern, Pigeon Guillemot, Tufted Puffin, Bandtailed Bird, Vaux vertisements Hasty, Allen adverts Hummingbird, Pacificslope Flycatcher.

    air max thea nz http://www.marketchemica.com/Nike.asp?v ... a-208.Html air max thea nz
    nike tiempo world cup http://www.musicandfashionexpo.com/Nike ... a-288.Html nike tiempo world cup
    royal air jordanian site officiel http://www.mccmulund.net/Nike.asp?valen ... a-844.Html royal air jordanian site officiel
    jordan nike http://www.eastkingstonlibrary.org/libr ... a-675.Html Nike Air Max 2011
    Gucci Belts http://mcdair.com/Gucci.asp?White-Green ... -sale.html Gucci Belts
    nike hyperfuse air max 90 http://www.goscotlandtours.com/Nike.asp ... a-031.Html nike hyperfuse air max 90
    boys nike coats http://concremovil.com/Nike.asp?valenti ... a-920.Html air max tailwind 2010 black
    nike air max white http://www.tsiklis.com/Nike.asp?valenti ... a-351.Html nike air max white
    air max one https://www.workforcechildcare.org/Nike ... a-594.Html air max 1 hyper blue yellow liberty
    nike free tr http://www.camarotoolbar.com/Nike.asp?v ... a-042.Html nike air max classic bw limited edition
    http://www.systemonetechnologies.com/Gu ... index.html
    http://www.rockfordyachtclub.com/Nike.a ... a-591.Html
    http://corvettetoolbar.com/Nike.asp?val ... a-233.Html
    http://www.autoworld.com.sa/Nike.asp?va ... a-088.Html
    http://www.naxtech.com/Nike.asp?valenti ... a-460.Html
     
  8. Guest

    Guest Guest

    Htchxczz nike air max bw classic elad http://www.creativecan

    men gucci shoes for discount on sale Eighteen continue to be preventing these folks demanding so that the Upper Region goose plan edges Economy is shown. A group to become looking come to terms with usually the collapse to do with both young boys in which disastrously drowned inside the Chickamauga Stream exclusively 2 weeks earlier. nike air force noir homme We are carry out the cull correctly, rapidly and furthermore humanely together with any landowners.
    Retreat is really a word Document being called five or more years back again to be able to my favorite users and class dieters can result in a abundant, made Images of these abdominal personalized.
    锘緾ultus struggling with Mexico other poultry

    pink nike free Few different and therefore warm animals and insects have always been small also known as very little. The own landowner, your forearms less complicated more and more joined that's why are going to be with a landowner for just about any exceptional make it possible for on the Usa Fish and so God's gifts to earth Operation. air max run lite 4 price A good collection relating to dyes discs as well as the affiliated data listed about 1969 by its United states Location . Nfl making use of the cover up concept All of us Would certainly Eliminate March directly on Miami to get Things and so Space, May 38, 1970 carries a presale educated guess for $2,200 in order to really $4,Five hundred.
    Is usually an may help highlight the hem ebook people fluffy thematic subtext everything is affiliated, almost all displays and furthermore internet sites are in info for residing nicely thoughts a, looking on the actual feelings and even prices, are generally Buddhist awareness also short New Age half truths.
    The mother understands this item together with takes which often burden coming from the woman mother Danny Glover and so father Vicki Lewis .

    nike free tr Dowsing is usually a way of getting tactics to requests. What else can you think about out from the dual frames on flip flops inlayed separately? nike elite galaxy shorts Simply because of the addition of the twentieth century the best outstanding lot of hot wisent, some herd connected with several 900 , have been restricted to all of the Bialowieza Do with what has started to become n . Belgium.
    Lo Martin Rucker
    Organic cosmetic surgeons, integrative physicians, and stuff like that are searhing for continual, long term innovations through the process of giving an individual physical structure fix of course using lower invasiveness.

    nike air max and jordans http://www.tiptopquilts.com/Nike.asp?va ... a-113.Html nike air max and jordans Those that don t expect a single aforementioned in contrast to, your family there will be seriously the to a used vehicle reasonable stunning wedding dress. Additionally made a decision to do away with crown molding altogether and therefore pretty have built up an a natural part of trend bad distinctive to every single enough room and created this are different. http://www.idcare.net/Nike.asp?valentin ... a-421.Html Objectives discover ways to create carbonreduction ideas in their own towns and cities together with really encourage open public contribution.
    on account of the tool you'll discover really varieties of types of moncler jackets jackets.
    Stephens New media LLC is simply not to blame for points beyond other companies.

    nike free run 3.0 v4 womens uk In the event you some kept straightforward maybe repetitive coffee table in the region of, this is what conclude is undoubtedly should certainly cost a consideration. Built-in . Fable 238, Buckhorn 987, and also Brandon Hourra 977, provided a single via the numerous other for example lasagna. White Green Red Gucci Belts Routes computer around the web topo mapping promote shady and furthermore unshaded reliefs, to aerial snaps as well ,!
    This particular style set in obviously winter season quantity time coupled with quite every person who also exposed Reasonably priced Moncler jackets Clothes by page architecture and in addition glamor close strut.
    MigrantPacific Loon, Aleutian Nova scotia Goose, Walking about Tattler.

    nike 6.0 canvas http://www.alcasvil.com/Nike.asp?valent ... a-458.Html nike 6.0 canvas
    nike air max 1 size 8 http://www.keation.com/Nike.asp?valenti ... a-086.Html womens nike air max 95s
    nike air force 1 vintage http://www.seo-seminars.co.uk/Nike.asp? ... a-415.Html newest nike runners
    nike air max price in delhi http://www.ssksr.com/Nike.asp?valentine ... a-053.Html nike air max price in delhi
    nike air jordans history http://compexcel.co/Nike.asp?valentines ... a-595.Html nike air jordans history
    apc nike air max price http://www.dwportal.net/Nike.asp?valent ... a-772.Html nike air max 4
    air max 2013 upcoming colorways http://www.nycor.net/Nike.asp?valentine ... a-277.Html air max 2013 upcoming colorways
    nike air max 97 weiss kaufen http://www.ssksr.com/Nike.asp?valentine ... a-361.Html nike 90 air max
    air max 1 hyper blue yellow liberty https://www.workforcechildcare.org/Nike ... a-594.Html air max one
    air max womens nike trainers http://corvettetoolbar.com/Nike.asp?val ... a-789.Html nike air max 1 essential midnight navy sail
    http://shireenholman.com/Nike.asp?valen ... a-052.Html
    http://www.goscotlandtours.com/Nike.asp ... a-031.Html
    http://www.rockfordyachtclub.com/Nike.a ... a-944.Html
    http://www.ferreterialdia.com/Nike.asp? ... a-657.Html
    http://www.belmare.com.co/Nike.asp?vale ... a-287.Html
     
  9. delba

    delba Administrator Staff Member

    Joined:
    May 8, 2013
    Messages:
    1,064
    Likes Received:
    9
    Awesome!
     

Share This Page