This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/BEAGLEBK: ways to write register or drived based c program for timer , uart , gpio through ti am355x linux sdk .

Part Number: BEAGLEBK
Other Parts Discussed in Thread: AM3358

Tool/software: Linux

I am a newbie related lo linux c  based programming  for arm based .

using  ti-am33xx sdk version 5.00.02 and kernel version shows 4.4.18.

able to test gpio , uart through linux header files  .

how to use regiser or driver based for beaglebone c  programming  

  • Manoj,

    I'm sorry, I'm not really able to follow what you are asking for. Maybe you could describe what you want to do or give an example?

    The SDK that TI provides is pretty standard Linux ported to our boards and platforms with some examples, documentation, etc. Developing for the SDK is not really any different than developing for any other Linux platform. TI only supports the low-level changes that we make to enable Linux and the integration of all the different packages we include to get folks off to a great start. We do not support generic Linux development as that is expected to be the expertise of the user.

    Do, depending on how you reply, we may or may not be able to help much and you may find better support or help in the general Linux community.

    I hope this helps explain our support model. Thanks.
  • I used a sample code through web , uart able to execute .
    #include <fcntl.h>
    #include <termios.h>
    #include <unistd.h>
    #include <stdio.h>


    int fd; /* port file descriptor */
    char port[20] = "/dev/ttyS1"; /* port to connect to */
    speed_t baud = B9600; /* baud rate */
    int i = 0;
    int main(){

    printf("opening port ");
    fd = open(port, O_RDWR); /* connect to port */

    /* set the other settings (in this case, 9600 8N1) */
    struct termios settings;
    tcgetattr(fd, &settings);

    cfsetospeed(&settings, baud); /* baud rate */
    cfsetispeed(&settings, baud);
    settings.c_cflag &= ~PARENB; /* no parity */
    settings.c_cflag &= ~CSTOPB; /* 1 stop bit */
    settings.c_cflag &= ~CSIZE;
    settings.c_cflag |= CS8 | CLOCAL; /* 8 bits */
    settings.c_lflag = ICANON; /* canonical mode */
    settings.c_oflag &= ~OPOST; /* raw output */

    tcsetattr(fd, TCSANOW, &settings); /* apply the settings */
    tcflush(fd, TCOFLUSH);

    /* — code to use the port here — */

    char buff[3]={0x00, 0x00, '\n'};
    while(i< 20){
    printf("forwarding message");

    write(fd,"BBDATA\n",7);
    // read(fd,&buff,sizeof(buff));
    printf("message : %s \n", &buff);
    i++;
    }

    close(fd); /* cleanup */
    }


    As per my observation , the code using Files format concept and linux header files .

    Is this process correct ?

    is any driver library or gpio register level library or driver based code format for AM3358 to perfom uart , gpio , timer ,adc , operations .with linux as os in beaglebone
  • Manoj,

    Most any Linux programming style should work with our platform. So, yes, the classic style of accessing h/w resources as files is supported as you indicate above it working for UART.

    We provide drivers that abstract the h/w that you mentioned and can generally be accessed by file handles like UART. We also provide the source for these drivers so if you want to use them as a reference. This documentation should help explain the basics of our drivers:

    software-dl.ti.com/.../Foundational_Components_Kernel_Drivers.html

    However, to learn the details, you may often find it best to refer to the source.

    I hope this is helpful to you.