How to read the LRADC on an i.MX23 programmatically?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to read the LRADC on an i.MX23 programmatically?

752件の閲覧回数
littleBitsman
Contributor I

Hi, I haven’t really done low-level programming in the past so bear with me.

I have an MCIMX233CAG4C in a miniature computer in a mini-Linux computer and I want to read the value of an input attached to the LRADC on pin 108 (LRADC0). How can I accomplish this via code? I haven’t found anything about actually reading the values anywhere.

(Note: I need to be able to get the value in Rust, and FFI is fine with me if reading the LRADC isn’t possible directly from Rust)

タグ(1)
0 件の賞賛
返信
6 返答(返信)

713件の閲覧回数
littleBitsman
Contributor I

I found that in the DTS (decompiled from the DTB), the LRADC is marked as disabled.

I'm not exactly sure how to re-enable it.

The kernel config says that the LRADC is enabled.

0 件の賞賛
返信

680件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

To enable it, mark the status of LRADC in DTS to "okay".

0 件の賞賛
返信

657件の閲覧回数
littleBitsman
Contributor I
I did that, along with copying some other settings from the torvalds/linux DTS with the LRADC in it (it was for i.MX23).
But now how do I actually read the LRADC?
I presume it has something to do with reading memory considering there is a setting for what memory register to put it at in the DTS.
0 件の賞賛
返信

655件の閲覧回数
littleBitsman
Contributor I
Also, this is the DTS I copied from (I skipped the clocks setting, set status to "okay", and added "mxs-lradc" to compatible)
https://github.com/torvalds/linux/blob/dc1c8034e31b14a2e5e212104ec508aec44ce1b9/arch/arm/boot/dts/nx...
0 件の賞賛
返信

573件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

You don't need to modify the imx23.dtsi.

 

for example: You just add the LRADC like this.

https://github.com/torvalds/linux/blob/dc1c8034e31b14a2e5e212104ec508aec44ce1b9/arch/arm/boot/dts/nx...

apbx@80040000 {
                    lradc@80050000 {
                                      status = "okay";
                                      fsl,lradc-touchscreen-wires = <4>;
                    };

And here is the driver.

https://github.com/torvalds/linux/blob/dc1c8034e31b14a2e5e212104ec508aec44ce1b9/drivers/mfd/mxs-lrad...

 

0 件の賞賛
返信

621件の閲覧回数
littleBitsman
Contributor I
And, the mxs-lradc driver already on that Linux image does not allow me to bind it to the LRADC, no matter what name I use (I tested "80050000.lradc", "lradc" and a couple others and all of them said "no such device).
Not sure if that is relevant
0 件の賞賛
返信