Week #6 and #7 : Connectivity issues, cleanup kernel style and millis/micros

The last 2 weeks have been kinda slow to be honest.

Well almost the entire last week I wasn’t able to do much because of internet connectivity issues. My oh-so-reliable ISP  showed it’s true colors. Crappy customer service combined with technical incompetence is a real pleasure to deal with.

To come back to the point this week and the previous I have been working on some cleanup. Got done with analogWriteResolution. There are some issues with the way I implemented I think, but I’ll come back to that later.
Cleaned up almost all the files using checkpatch.pl so that we now are adhering to the kernel style of C coding (the spaces the tabs etc etc).

Apart from this, I am slightly stuck up on millis and micros function implementation under linux. What i need these functions to do is keep a record of the time spent executing the current function. So what I have to basically do is have store a timestamp when the function starts and then every time millis and micros is called, I get the latest timestamp and subtract it from the stored one and display the time. I have tried doing this with gettimeofday from sys/time.h but the tests had very inconsistent results. I added a usleep of 1000 ms in between taking readings and the output should have (ideally) been 1 sec between each printf. But there was a huge variation in between readings.

Millis and micros are one of the core Arduino functions, so to speak. They aren’t part of any library and are expected to work out of the box. So I am going to have to figure out how to solve this sooner or later.

Apart from this I am really hoping to get done with Serial, I2C and SPI. Serial is a bit tricky I guess, but the other 2 can be dealt with pretty quickly. And they are 2 of the most commonly used libraries I guess.

I also got in touch with Sudar Muthu who is a really cool hacker from Banglore (we built on his makefile for Arduino btw). He was interested in the work that we are doing at Userspace arduino 🙂

PS: I cleared the mid term evaluations. 🙂


One Comment on “Week #6 and #7 : Connectivity issues, cleanup kernel style and millis/micros”

  1. Thomas Cort says:

    Have you tried the clock() function for keeping track of millis/micros?

    clock_t begin, end;
    double time_spent;

    begin = clock();
    /* do stuff here */
    end = clock();
    time_spent = (double)(end – begin) / CLOCKS_PER_SEC;

    Another option might be ru_utime and ru_stime from getrusage().

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s