Nice! I'm working on improving the tool with support for a config file and sensible defaults for the pyra, and maybe some better cleanup on module unload so it resets the events. Unfortunately, my volume wheel came off so I'll have to resolder it to test. Hopefully, the PCB pad didn't come off...
I think that should be
./pyra_vol_monitor 2 echo
for the Pyra.
I've forked the Linux repo on GitHub and pushed my working branch: https://github.com/Risca/linux/tree/palmas_gpadc
The very last commit is only meant for my devboard though, since it changes the IN1 channel from temp sensor to...
I'm based on git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git, tag 08.04.00.004 (Linux-5.10.120).
You mean the patches don't apply clean on letux-6.1-rc2?
Sure!
Small update today. Fixed the bug where reading the threshold value would give you a different value as when you write the threshold :) Kernel patches attached
Finally some updates!
I got a simple monitor userspace program working now, and it works "okay" :) I still see some bugs from the kernel driver (I think!), and the program is quite limited. The kernel driver occasionally gets stuck and cannot change threshold values. I haven't figured out yet...
I'm off to Oktoberfest this week, so I'll not have time to work on this in the near future. Maybe I'll see any of you there? I'll be wearing lederhosen! :D
I run a custom OS based on Buildroot and it doesn't autoload the palmas_gpadc.ko. I usually overwrite the existing module and then do rmmod + insmod.
What does lsmod show? Who is using the palmas_gpadc module?
Oh, now I remember! The original kernel module has a bug in palmas_gpadc_remove() so...
Okay, finally got some time to work on this (on a train!) and I think I got the driver code fairly stable now. I managed to rip off the solder pad for R82, so I had to start using GPADC_IN1 which is routed to R80 right next to R82.
I'll fix up the code in proper git, email friendly patches...
Okay, got most of the boilerplate code done to set high and low threshold values from userspace and integrate with the IIO Event subsystem. In theory, this should be enough to create a userspace application that will get woken up only when the "volume" (ADC value) changes. The TWL6037 will...
Eureka! I can get interrupts from TWL6037 on both high and low threshold! No more polling needed :)
# insmod /lib/modules/5.10.120/kernel/drivers/iio/adc/palmas_gpadc.ko
[ 1585.028884] palmas-gpadc 48070000.i2c:palmas@48:gpadc: palmas_adc_wakeup_configure
# [ 1592.146455] palmas-gpadc...
Okay, so this was easier to test than I first anticipated :D I wasn't able to test the thresholds, but I can confirm that it's possible to program both "slots" with the same channel! I noticed that channel 7 on my devboard was changing values up and down a bit so I setup TWL6037 to continuously...
So, after some datasheet reading and pondering, I have an idea!
The datasheets that I've read for various "palmas" type devices (i.e. TWL6037) says that when the device is in "AUTO" mode then 1 or 2 channels can be periodically sampled. For each channel being sampled, a threshold can be set and...
Another common technique is to define the whole peripheral register space as a struct and then cast the base address of the peripheral to this struct. In my case it would look something like this:
struct __attribute__((__packed__)) GPIO {
UInt8 padding1[0x13C];
UInt32 DATAOUT;
UInt8...
First of all, my defines doesn't use the values written in the datasheet. That's a source of confusion. Sure, I left a comment in there, but that comment fail to explain how that address mapping happened.
The address mapping (or offset) is part of my firmware. Linux will read my firmware and...
I took a quick look at the Linux I2C driver and it shouldn't be that hard to implement a simple driver in the M4. We fortunately doesn't have to cover all the little corner cases that the Linux driver has to, and we can focus on the polling path and ignore interrupts.
I'm busy this weekend, so...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.