Skip to content

mcp3422.ko Kernel module #1330

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

Closed
mypiandrew opened this issue Mar 8, 2016 · 18 comments
Closed

mcp3422.ko Kernel module #1330

mypiandrew opened this issue Mar 8, 2016 · 18 comments

Comments

@mypiandrew
Copy link

Hi

Would it be possible to include a mcp3422.ko file as part of the standard build (in a similar fashion to the can bus mcp251x.ko please?

@pelwell
Copy link
Contributor

pelwell commented Mar 8, 2016

CONFIG_MCP3422=m is the required setting. The module is only 10KB.

@popcornmix?

@popcornmix
Copy link
Collaborator

Sounds okay. Will add.

popcornmix added a commit to raspberrypi/firmware that referenced this issue Mar 9, 2016
…YUV images

See: #520

firmware: spdif: Allow compressed audio flag to be forced
See: #561

kernel: vchiq_arm: Tweak the logging output

kernel: bcm2835-sdhost: Only claim one DMA channel
kernel: bcm2835-mmc: Only claim one DMA channel
See: raspberrypi/linux#1327

kernel: Pi3 DT: Add pull-ups on the UART RX lines

kernel: config: Add module for mcp3422 ADC
See: raspberrypi/linux#1330

kernel: brcmfmac: Disable power management
See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=138312

kernel: serial: Take care starting a hung-up tty's port
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Mar 9, 2016
…YUV images

See: raspberrypi/firmware#520

firmware: spdif: Allow compressed audio flag to be forced
See: raspberrypi/firmware#561

kernel: vchiq_arm: Tweak the logging output

kernel: bcm2835-sdhost: Only claim one DMA channel
kernel: bcm2835-mmc: Only claim one DMA channel
See: raspberrypi/linux#1327

kernel: Pi3 DT: Add pull-ups on the UART RX lines

kernel: config: Add module for mcp3422 ADC
See: raspberrypi/linux#1330

kernel: brcmfmac: Disable power management
See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=138312

kernel: serial: Take care starting a hung-up tty's port
@popcornmix
Copy link
Collaborator

This is in latest rpi-update firmware.
@mypiandrew please test and close if happy.

@mypiandrew
Copy link
Author

Hi, Wow that was quick!

I'm probably doing something silly here, but have done rpi-update which ran sucessfully (still running on Wheezy at the moment)

Can't get the modules to install :

I'm using a crib from steps 10 & 11 here : https://github.com/angeloc/linux_iio_mcp3422

root@raspberrypi:/# uname -a
Linux raspberrypi 4.1.19+ #853 Wed Mar 9 18:04:48 GMT 2016 armv6l GNU/Linux

root@raspberrypi:/# insmod /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko
Error: could not insert module /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko: Unknown symbol in module

root@raspberrypi:/# insmod /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp320x.ko
Error: could not insert module /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp320x.ko: Unknown symbol in module

Not sure why there are two different .ko files in that directory, was only expecting one - but then kernel modules is not my forte to be honest

Just for fun I tried the other module area :

root@raspberrypi:/# insmod /lib/modules/4.1.19-v7+/kernel/drivers/iio/adc/mcp3422.ko
Error: could not insert module /lib/modules/4.1.19-v7+/kernel/drivers/iio/adc/mcp3422.ko: Invalid module format

That's expected I guess as I'm not running that kernel

This then didn't work (kind of expected as there's no driver module loaded)

root@raspberrypi:/# echo mcp3424 0x6e > /sys/bus/i2c/devices/i2c-1/new_device
-bash: echo: write error: Invalid argument

This might be helpful :

root@raspberrypi:/# dmesg | tail -15
[ 429.131954] mcp3422: Unknown symbol devm_iio_device_register (err 0)
[ 447.545108] mcp320x: Unknown symbol devm_iio_device_alloc (err 0)
[ 447.545177] mcp320x: Unknown symbol iio_device_unregister (err 0)
[ 447.545208] mcp320x: Unknown symbol iio_device_register (err 0)
[ 485.289733] i2c i2c-1: Failed to register i2c client mcp3424 at 0x6e (-16)
[ 533.166576] i2c i2c-1: Failed to register i2c client mcp3424 at 0x6e (-16)
[ 554.283738] i2c i2c-1: Failed to register i2c client mcp3424 at 0x6e (-16)
[ 569.320659] mcp3422: disagrees about version of symbol module_layout
[ 606.009641] mcp3422: Unknown symbol devm_iio_device_alloc (err 0)
[ 606.009697] mcp3422: Unknown symbol devm_iio_device_register (err 0)
[ 778.460881] mcp320x: Unknown symbol devm_iio_device_alloc (err 0)
[ 778.460949] mcp320x: Unknown symbol iio_device_unregister (err 0)
[ 778.460981] mcp320x: Unknown symbol iio_device_register (err 0)
[ 937.631274] mcp3422: Unknown symbol devm_iio_device_alloc (err 0)
[ 937.631327] mcp3422: Unknown symbol devm_iio_device_register (err 0)

The last 2 were generated by running :

insmod /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko

Any ideas as to what's not happening here ?

@popcornmix
Copy link
Collaborator

Does this work for you:

pi@domnfs:~ $ sudo modprobe mcp3422
pi@domnfs:~ $ lsmod
Module                  Size  Used by
mcp3422                 3979  0 
industrialio           34435  1 mcp3422
rpcsec_gss_krb5        21204  0 
joydev                  9024  0 
evdev                  10278  6 
brcmfmac              177635  0 
brcmutil                5501  1 brcmfmac
cfg80211              407580  1 brcmfmac
rfkill                 16036  2 cfg80211
bcm2835_gpiomem         2860  0 
bcm2835_rng             1763  0 
uio_pdrv_genirq         2944  0 
uio                     7753  1 uio_pdrv_genirq
i2c_dev                 5671  0 
fuse                   80694  1 
ipv6                  338660  44 

@popcornmix
Copy link
Collaborator

I assume you rebooted after running rpi-update?
What does uname -a report?

@mypiandrew
Copy link
Author

Yes I rebooted

root@raspberrypi:/# modprobe mcp3422
ERROR: could not insert 'mcp3422': Unknown symbol in module, or unknown parameter (see dmesg)

root@raspberrypi:/# uname -a
Linux raspberrypi 4.1.19+ #853 Wed Mar 9 18:04:48 GMT 2016 armv6l GNU/Linux

root@raspberrypi:/# dmesg | tail -5
[ 937.631274] mcp3422: Unknown symbol devm_iio_device_alloc (err 0)
[ 937.631327] mcp3422: Unknown symbol devm_iio_device_register (err 0)
[ 1222.438448] i2c i2c-1: Failed to register i2c client mcp3424 at 0x6e (-16)
[ 1321.081637] mcp3422: Unknown symbol devm_iio_device_alloc (err 0)
[ 1321.081690] mcp3422: Unknown symbol devm_iio_device_register (err 0)

@mypiandrew
Copy link
Author

I'm still running Wheezy if that has any bearing on things?

@popcornmix
Copy link
Collaborator

Lets check with Pi1

pi@domnfs:~ $ uname -a
Linux domnfs 4.1.19+ #853 Wed Mar 9 18:04:48 GMT 2016 armv6l GNU/Linux
pi@domnfs:~ $ sudo modprobe mcp3422
pi@domnfs:~ $ lsmod
Module                  Size  Used by
mcp3422                 4965  0 
industrialio           45124  1 mcp3422
cfg80211              479279  0 
rfkill                 21508  1 cfg80211
joydev                  9320  0 
evdev                  10534  2 
bcm2835_gpiomem         3703  0 
bcm2835_rng             2207  0 
uio_pdrv_genirq         3526  0 
uio                    10078  1 uio_pdrv_genirq
i2c_dev                 6386  0 
fuse                   86348  1 
ipv6                  358811  28 

still seems okay. What does this report:

pi@domnfs:~ $ md5sum /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko
cd7a7db6b0608ed8658f0bfdd1e975ff  /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko

@mypiandrew
Copy link
Author

I'm sorry about this, I didn't mean to cause trouble :(

@mypiandrew
Copy link
Author

root@raspberrypi:/# md5sum /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko
cd7a7db6b0608ed8658f0bfdd1e975ff /lib/modules/4.1.19+/kernel/drivers/iio/adc/mcp3422.ko

@popcornmix
Copy link
Collaborator

Wheezy is no longer supported by us and I am on Jessie, but I can't think why that could cause a difference.

Can you try running sudo depmod and rebooting just to be sure.

@mypiandrew
Copy link
Author

I already have a RTC present on the I2c
i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- 6e --
70: -- -- -- -- -- -- -- --

root@raspberrypi:/# lsmod
Module Size Used by
rtc_ds1307 10459 0
i2c_dev 6386 0
sg 20575 0
sierra 8968 0
ftdi_sio 32602 0
usbserial 29593 2 sierra,ftdi_sio
i2c_bcm2708 5988 0
spi_bcm2835 7868 0
bcm2835_gpiomem 3703 0
bcm2835_rng 2207 0
uio_pdrv_genirq 3526 0
uio 10078 1 uio_pdrv_genirq

@mypiandrew
Copy link
Author

oh!

we have a winner

root@raspberrypi:# modprobe mcp3422
root@raspberrypi:
# lsmod
Module Size Used by
mcp3422 4965 0
industrialio 45124 1 mcp3422
rtc_ds1307 10459 0
i2c_dev 6386 0
sg 20575 0
ftdi_sio 32602 0
sierra 8968 0
usbserial 29593 2 sierra,ftdi_sio
i2c_bcm2708 5988 0
spi_bcm2835 7868 0
bcm2835_gpiomem 3703 0
bcm2835_rng 2207 0
uio_pdrv_genirq 3526 0
uio 10078 1 uio_pdrv_genirq

root@raspberrypi:# echo mcp3424 0x6e > /sys/bus/i2c/devices/i2c-1/new_device
root@raspberrypi:
# cd /sys/bus/i2c/devices/1-006e/iio:device0/
root@raspberrypi:/sys/bus/i2c/devices/1-006e/iio:device0# ls -l
total 0
-r--r--r-- 1 root root 4096 Mar 9 19:27 dev
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage0_raw
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage0_scale
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage1_raw
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage1_scale
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage2_raw
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage2_scale
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage3_raw
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage3_scale
-rw-r--r-- 1 root root 4096 Mar 9 19:27 in_voltage_sampling_frequency
-r--r--r-- 1 root root 4096 Mar 9 19:27 in_voltage_scale_available
-r--r--r-- 1 root root 4096 Mar 9 19:27 name
-r--r--r-- 1 root root 4096 Mar 9 19:27 sampling_frequency_available
lrwxrwxrwx 1 root root 0 Mar 9 19:27 subsystem -> ../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Mar 9 19:27 uevent

@mypiandrew
Copy link
Author

Did :

depmod
reboot

And then the above

@mypiandrew
Copy link
Author

As fast as my little fingers can cut wires I'll hook up Chan0 to the 1.8v rail for a test of my hardware

Thank-you very very much, I really appreciate the time and support

@popcornmix
Copy link
Collaborator

rpi-update does run depmod, but perhaps it didn't complete. Looks like it's okay now (and worth remembering that depmod updates module dependencies if you have problems again).

@mypiandrew
Copy link
Author

As Dracula would say...."Fangs" :-)

neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this issue Feb 27, 2017
…YUV images

See: raspberrypi#520

firmware: spdif: Allow compressed audio flag to be forced
See: raspberrypi#561

kernel: vchiq_arm: Tweak the logging output

kernel: bcm2835-sdhost: Only claim one DMA channel
kernel: bcm2835-mmc: Only claim one DMA channel
See: raspberrypi/linux#1327

kernel: Pi3 DT: Add pull-ups on the UART RX lines

kernel: config: Add module for mcp3422 ADC
See: raspberrypi/linux#1330

kernel: brcmfmac: Disable power management
See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=138312

kernel: serial: Take care starting a hung-up tty's port
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

3 participants