Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble enabling 4 single channel inputs with gain changes #1

Open
scottellis opened this issue Feb 18, 2017 · 5 comments
Open

Trouble enabling 4 single channel inputs with gain changes #1

scottellis opened this issue Feb 18, 2017 · 5 comments

Comments

@scottellis
Copy link

Hi Erik,

Sorry if this is a bit long.

I working with your overlay from the RPi kernel repo.

There seems to be a truncation of the parameters happening when the overlay is used.

I wanted to enable all 4 channels single-ended with a max of 4V so I could read up to 3.3v

dtoverlay=ads1015:cha_enable,cha_gain=1,chb_enable,chb_gain=1,chc_enable,chc_gain=1,chd_enable,chd_gain=1

With that line, ch7 doesn't show up in sysfs and ch6 maxes out at 2V the default. Ch4 and ch5 read up to 3.3V.

If I try the following, ch6 is still limited to 2v.

dtoverlay=ads1015:cha_enable,cha_gain=1,chb_enable,chb_gain=1,chc_enable,chc_gain=1

If I do the following, I get ch5-7, but only ch5 and ch6 read 3.3v, ch 7 is still limited to 2v

dtoverlay=ads1015:chb_enable,chb_gain=1,chc_enable,chc_gain=1,chd_enable,chd_gain=1

I think it's a buffer overflow thing because I can switch the order of the params and get different behaviour

For example, this enables all channels, but now only ch7 allows 3.3v, ch4-6 are limited to 2V.

dtoverlay=ads1015:cha_enable,chb_enable,chc_enable,chd_enable,chd_gain=1,chc_gain=1,chb_gain=1,cha_gain=1

And finally, if I modify your dts so that instead of chX_enable it is just chX, then it appears all params get parsed and all 4 channels can read up to 3.3v

dtoverlay=ads1015,cha,cha_gain=1,chb,chb_gain=1,chc,chc_gain=1,chd,chd_gain=1

Have you seen this behavior?

I am using a 4.4.48 kernel.

@eriksejr
Copy link
Owner

Hi Scott,
Sorry I didn't see this sooner. I didn't run into this problem as I never had a need to use all channels of the device for my application. Your assumption that the line is getting truncated seems reasonable. I assume there's a limit on the length of the dtoverlay line within the RPI kernel, particularly if you you don't see everything showing up in the device tree.

Have you tried to use it putting each parameter on its own line in the /boot/config.txt file? Maybe try something like this:

dtoverlay=ads1015
dtparam=addr=0x48
dtparam=cha_enable=true
dtparam=cha_cfg=4
dtparam=cha_gain=0
dtparam=cha_datarate=0

I'm running a slightly older kernel then you (4.4.43) but this has worked for me since I've been using the device.

@scottellis
Copy link
Author

scottellis commented Feb 21, 2017 via email

@eriksejr
Copy link
Owner

Hi Scott,
I'm not certain if you could use parameters to define which chip it is. If you simply change:

compatible = "ti,ads1015";
to
compatible = "ti,ads1115";

But leave the rest unchanged, does the driver ID the chip as an 1115? If the change is that simple, I think its more likely the overlay could be modified to make that a parameter somehow and allow you to use it for both chips. The driver only seems to load a different rate table for the 1115 then for the 1015 and adjusts the full-scale due to the 1115 being 16-bit vs the 1015 being 12-bit. So there appears to be very little difference between them on that side of things.

I'm not really a dtb expert though, this was actually my first dtb overlay. Further to that, it was really due to my inexperience that I didn't ask the RPI dev who committed it to get the module built with the kernel by default. I'm afraid I don't know what the policy is on that and how they decide which modules to include with the raspbian kernel - I would need to ask them.

In respect to where the truncation is taking place, I can't say I've looked that thoroughly but I've found some threads that suggest that config.txt is read by start.elf at boot. If the truncation is taking place in there you won't be able to find the source as that is proprietary code.

Regards,
Erik

@scottellis
Copy link
Author

scottellis commented Feb 22, 2017 via email

@scottellis
Copy link
Author

scottellis commented Feb 23, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants