Replies: 8 comments 15 replies
-
To reply my own question, I think I found the answer. The following worked just perfect (at least I can build, I haven't tried it on a real hardware to see if it works yet) and if I understand it correctly, I think the problem was that I was missing the two parameters "#address-cells" and "#size-cells". &i2c0 {
lis2dh@18 {
compatible = "st,lis2dh";
label = "LIS2DH";
reg = <0x18>;
irq-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>, <&gpio0 30 GPIO_ACTIVE_HIGH>;
disconnect-sdo-sa0-pull-up;
};
i2c_adc: ads1015@48 {
compatible = "ti,ads1015";
reg = <0x48>;
#io-channel-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
};
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
};
channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
};
channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
};
};
}; |
Beta Was this translation helpful? Give feedback.
-
Hi, I had a similar problem with another ADC module and your solution helped me - the project is building. I'd like to know if you've managed to use this with real hardware and if so, how did you refer to the individual channels of the external ADC in the code, because I'm having trouble with this? |
Beta Was this translation helpful? Give feedback.
-
Got it, thanks |
Beta Was this translation helpful? Give feedback.
-
Hi, have the same issue with an ADS1115. I configured everything like you but the ADC shell command doesn’t list the ADC (only the internal one), not sure how to proceed from here, there must be a way… |
Beta Was this translation helpful? Give feedback.
-
DT_HAS_TI_ADC_ADS1112_ENABLED is set when you add node compatible with it
to your device tree overlay and set its status to "okay"
czw., 19 wrz 2024, 20:58 użytkownik Gaston ***@***.***>
napisał:
… @GilDev <https://github.com/GilDev> Im using the ads1112 from TI and I
want to enable the driver n zephyr, but there is no example or something
else. Reading the Kconfig of this device I can see that it needs
CONFIG_ADC=y and also depends on DT_HAS_TI_ADC_ADS1112_ENABLED....where do
I set this devicetree entry? in the source file?
—
Reply to this email directly, view it on GitHub
<#61960 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BBYUXKK7JMHE7V3JVKE254TZXMNGDAVCNFSM6AAAAAA4BFIIUCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANRZG4YDEMA>
.
You are receiving this because you commented.Message ID:
***@***.***
.com>
|
Beta Was this translation helpful? Give feedback.
-
I must say that I have now decided to switch back to the upstream driver. I think it more or less works fine with ADS1015, one just needs to know that the driver assumes there is only one channel. This is in essence correct, as the other channels are "artificially" created with the MUX, but the ADC core has one channel. Thus, the user only needs to define the device in the devicetree and then before each conversion, the ADC needs to setup the correct channel through the MUX (the driver is up for the job, the user needs to use
|
Beta Was this translation helpful? Give feedback.
-
Hi everyone, I’m currently working on reading data from a pressure sensor using Zephyr, an ADS1115 ADC, and a Raspberry Pi 4. I’ve gone through all the responses in this thread and set up my environment accordingly, but unfortunately, I still can’t get the device to be detected. Would anyone be able to help me troubleshoot or point out what I might be missing? I’d really appreciate any guidance. Thanks! overlayI add an overlay file here
prj.conf
C #include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/adc.h>
const struct device *adc_dev = DEVICE_DT_GET_ANY(ads1115);
int main(void) {
if (adc_dev == NULL) {
printk("Failed to get ADS1115 ADC device binding\n");
return 0;
}
return 0;
}; Result
|
Beta Was this translation helpful? Give feedback.
-
There is an other issue, #78973, which explains the background. As midterm work-around, I use an approach with multiple standard channel definitions.
As already written above, the driver will reject all channels with a different id as 0.
Not really nice and requires some extra Macros to be portable for other ADCs. But it allows to define the channels in the device tree. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been trying to enable the ADC driver to use it with my external ADS1015 IC, but I haven't been able to succeed so far. The sample application is unfortunately only using the internal ADCs of the MCUs, so I don't have a good reference on how to do it.
I'm targeting an ESP32 custom board.
First things first, this is how my overlay looked like in the beginning:
So far so good, I could get the device using the DEVICE_DT_GET_ANY
But then I have to be able to configure the individual channels of the ADC, so I tried doing it how it is shown in the sample for the ADC driver. So I thought I should add the channel subnode below the ADC
But I have the feeling that this is not the correct way, because I then get a weird devicetree error
Has anybody tried it or has a good bet on how to do it properly?
Beta Was this translation helpful? Give feedback.
All reactions