3 Replies Latest reply on Dec 10, 2015 8:19 AM by Intel_Peter

    Yocto + C , serial Datalog and trigger


      Hello all,

      I'm working in a project, goal is


      - Read and save data from 2 serial ports at 115,200 bps, one binary, one in text, lot of data flow, no problem with this.

      - When 5v trigger signal arrive to digital input, i need to do a procedure in REAL TIME.


      I will try to do this in C, but i need to know:


      - How can i read/write digital input/Output from C, some samples?

      - Galileo will be reading and saving data from 2 serial, and processor will be busy, i need to set priority to digital input process, because this need to be in real time (is a accurate timing set process)

        i need to know how to do this.


      Comments will be really appreciated.


      Thank you!


        • 1. Re: Yocto + C , serial Datalog and trigger

          Hello cristian_lainfo,


          In order to interact with the Galileo's GPIOs, the best option would be to use mraa, it supports interrupts which if I understood you correctly is what you need. Here's an example of how to use interrupts and here's another simple example of a blink. I hope this information helps you.



          • 2. Re: Yocto + C , serial Datalog and trigger

            Hello, and thank you for your answer, a lot of help.


            i need to receive a 5v signal GPS pulse (PPS) in one digital input using interrupts for real time.

            each time i receive this signal, i need to do:


            - set to high another digital output, to send the signal 5v to another device.

            - Launch a process (a C function).


            I'm working in C under yocto, mraa is installed.


            Do you have some sample on how to do this? or i can pay consulting to anybody; i really need to do this..


            Thank you, regards!



            • 3. Re: Yocto + C , serial Datalog and trigger

              As I mentioned in my previous post, you can find the interrupt example in mraa/isr_pin6.c at master · intel-iot-devkit/mraa · GitHub.

              If I understood you correctly then you need the interrupt signal to set another pin to go to a HIGH state and at the same time call a different function. This function, again if I got it right, is not within this code but it is a completely different script, right?


              Then this shouldn't be that hard once you have received the interrupt signal, here's some pseudo code to guide you a little bit on what your code should look like:


              //interrupt process
              int pinstate = 0;
                printf("The interrupt has been activated");
                pinstate = !pinstate;
               mraa_gpio_write(gpio, pin);


              This is not exactly all the code you will need but you can see that it is actually pretty simple once the interrupt is done. Regarding the other function you have to call, as in my example, I'd use a system call to execute it. You can learn more how to use system calls in C in system(3): execute shell command - Linux man page.