1 Reply Latest reply on Mar 19, 2015 2:25 PM by ForumMigrationAdmin

    mraa_uart_init(0) fails on Galileo Gen2


      I've been attempting to get the ttyS0 to talk to a socketmodem on my Galileo GEN2 from a native C app.  I built the mraa sample code for exposing the rx/tx pins which calls 0).  It should return an instance of mraa_uart_context but instead I get a NULL.

      I looked at the libmraa source and it's pretty clear that mraa_uart_init will return NULL in exactly 3 circumstances:

      1. advance_func->uart_init_pre fails
      2. advance_func->uart_init_post fails
      3. mraa_setup_uart fails.

      Since intel_galileo_rev_g.c doesn't set up either advance_func->uart_init_pre or advance_func->uart_init_post they can be ruled out immediately because they never get called. That leaves mraa_setup_uart(int) as the culprit:

      01mraa_setup_uart(int index)






      03    if (plat == NULL)









      06    if (plat->uart_dev_count == 0)



      07        return MRAA_ERROR_FEATURE_NOT_SUPPORTED;






      09    if (plat->uart_dev_count <= index)



      10        return MRAA_ERROR_NO_RESOURCES;






      12    int pos = plat->uart_dev[index].rx;



      13    if (pos >= 0) {



      14        if (plat->pins[pos].uart.mux_total > 0)



      15            if (mraa_setup_mux_mapped(plat->pins[pos].uart) != MRAA_SUCCESS)



      16                return MRAA_ERROR_INVALID_RESOURCE;



      17    }






      19    if (pos >= 0) {



      20        pos = plat->uart_dev[index].tx;



      21        if (plat->pins[pos].uart.mux_total > 0)



      22            if (mraa_setup_mux_mapped(plat->pins[pos].uart) != MRAA_SUCCESS)



      23                return MRAA_ERROR_INVALID_RESOURCE;



      24    }






      26    return MRAA_SUCCESS;





      I think the first three sanity checks can be ignored as unlikely.  I imagine the problem comes from one of the calls to mraa_setup_mux_mapped().

      Since I assume that this works on some GEN2 boards what I really would like to know is why is my board different?  I have other evidence to suggest that it is different like the fact that the Debian images built by @StuartAnderson and others fail in very hardware suspicious ways.  Since the documentation is extremely incoherent on the subject of board revision, I would really love it if somebody would explain briefly how the revision naming scheme works in Galileo/Edison land.  For instance, the MRAA lib documentation suggests that it only works on GEN2 boards that are "RevG".  That suggests they there are other revisions of GEN2 boards.  How do I determine that?  I don't see it silkscreened on the PCB.  Examing /sys on my boards I get:

      /sys/devices/virtual/dmi/id/board_name: GalileoGen2

      cat /sys/devices/virtual/dmi/id/board_version: FAB-D

      Does that mean GEN2 revD?  Man I'm confused ...

      I would super appreciate it if someone like Mathias or Brenddan or maybe Tom (or anybody who knows for sure) would give me a little insight here. If nobody has time to look at the problem I will be glad to debug the issue.  Just need to know how to build the library with debug turned on.  The github instructions for building the lib under the IODTK are for Edison.


      This is a big issue for us.  Thanks hugely in advance for any help,