Sunday, 7 July 2013

Ring Buffer issues

Access to the ADC using the /dev/iio entries is supported on the kernel side by implementing buffers.. /dev/iio is basically used for continuous sampling.

One-shot sampling is implemented via the sysfs interfaces. One-shot is up and running. So now I turned my attention to continuous sampling.

TI has implemented it for 3.2 in the following commit.
http://arago-project.org/git/projects/?p=linux-am33x.git;a=commitdiff;h=b332370651a7d64d3c6ed8780d939fc18163e141;hp=09597d7a244a8e6f5ea79da3c5dced3a5ea620c4

I went through it manually and applied all the changes to my adc file.

However..

I found out that it was a big time waste. The underlying buffer being used by the driver in the 3.2 based tree was implemented in ring_sw.c

This buffer was depreciated and none of the drivers use it any more!
The linux kernel has moved on to another kfifo based implementation or something.

This patch is might require some really nitty gritty work.. Or it might just be a few carefully chosen lines to replace..

Uboot tftpboot notes


https://gist.github.com/17twenty/2718613 Good stuff on automating tftp boot.

uenv to boot from the kernel on my laptop

optargs=quiet drm.debug=7

ipaddr=192.168.0.250
serverip=192.168.0.1
#run tftpboot 0x80200000 uImage
#uenvcmd=run loaduimage run loadfdt run mmcargs bootz 0x802800000 - 0x80F80000

bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
uenvcmd=echo "Booting from Network";tftpboot 0x80200000 uImage; bootm 0x80200000

Friday, 5 July 2013

Pull requests

Took a while to get git up and running the way i wanted.
It can have a steep learning curve!

And we have pull requests
https://github.com/beagleboard/kernel/pull/48 for the 3.8 tree
https://github.com/beagleboard/kernel/pull/47 for the 3.11 tree

Time to chill for the weekend!
:)

Update. They've been merged. Yeaaaaaaaaaaa :)

4 wire resistive touchscreen HW emulator

 
While the TSC is on its way, I couldn't just move on with tinkering the ADC drivers without knowing if I've accidentally broken the TSC ones.

So here comes the hardware 4 wire touchscreen emulator!

Folks at #beagle-gsoc were pretty helpful in guiding me on how to test the TSC without the TSC.

"evtest /dev/input/touchscreen0 " runs a great utility detecting touchscreen input.

And the hardware is just resistors/potentiometers.

I googled and after a while. This is what I could come up with. Note : Dont use 100K ohm resistors. I tried. It doesnt work. :p
These are in the range of 10K ohms.

The circuit is kinda like.

AIN0 --- Pot1        Pot4 ---AIN2
               |               |
                    Pot 3
                      |
                  Button
               |               |
AIN1 --- Pot2          Pot5--- AIN3


evtest gives great output. pot 3 controls the pressure value.
pot 1/2/4/5 control X/Y coordinates.

So.
Who needs a touchscreen when you have potentiometers! :)

Thursday, 4 July 2013

One-shot ADC reading in 3.11

I successfully reinvented the wheel :)

After realizing that IIO was disabled in Kconfig, it was easy once things started running somewhat. Previously it'll all be just blank!

Manually re-based the patches that I had done previously for 3.8.

I have one-shot ADC reading up and fixed for 3.11.

These patches can be upstreamed too! Especially the one that fixes the first sample read and the Ebusy signal bugs.

The iio-scale parameter requires a bit more refinement. At the moment, I have fixed the scale to 1800mV which is for BBB. Ideally this should be read from somewhere(perhaps a configured register..) or an input via sysfs..

I really need to get around configuring the resisters for the TSC test. Evtest works great. But I'll need switches and a few pots for a proper test bench..

Too pre-occupied with the MSc thesis during the day time.

Now for looking at how to update my github fork so that I can upload these patches and send a pull request to koen.. Have to send that pull request for the 3.8 ones too..

IIO in 3.11

It took ages to realize that IIO had not been enabled in the Kconfig file!!

I was trying to debug why the ADC wasn't working and if the DT was wrong etc.

O well.. I guess a guy has to learn these things from experience..

Wednesday, 3 July 2013

IIO Map for bone-helper

IIO has a map interface that was used by the bone-helper function.
This was added via a patch in the old patch series.

I didnt want to disturb people using the bone-helper function so I added the patch (after the required modifications) to my series as well.

the bone-helper now works great. Doesn't give erroneous values. And doesn't require multiple refreshes either.

https://github.com/ZubairLK/kernel/blob/3.8-adc-fixes/patches/adc/0021-Add-IIO-map-interface-for-bone-helper-Most-of-the-wo.patch