ADE7880 / ADE7854

I'm trying to connect an ADE7880 meter eval board to a beaglebone. I noticed the IIO driver for 7874 and found a tech document that documented the register remapping and other changes between the 7854 and 7880. I'm currently testing setting up the IIO device and am having problems. I compiled a kernel with the ad7854 and ad7854-spi kernel modules (ultimately I will be connecting the devices via SPI). I insmod both modules and they load successfully (as evidenced by the warning about staging modules and looking at /proc/modules) but when I go into sys/bus/iio/devices I don't see anything.

My assumption is that even without a device hooked up I should see entries under devices; assuming this works then I believe I can just swap in my modified 7880 module and with any luck it should work (ideally I'd like to use the netscope demo from the wiki once i get it setup). Can any provide some pointers on troubleshooting iio?

  • 0
    •  Analog Employees 
    on Nov 26, 2012 8:11 AM over 7 years ago


    Loading the driver alone won't do it. You still need to register a SPI device to tell the kernel on which SPI bus and with what chipselect it should look for the device. You need to setup a spi_board_info structure and register it using spi_register_board_info.


    static struct spi_board_info spi_board_info[] __initdata = {
                        .modalias          = "ade7854",
                        .mode                    = SPI_MODE_3,
                        .max_speed_hz          = 1000000,
                        .bus_num          = 0,
                        .chip_select          = 1,
    spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));

    The bus_num and chip_select fields are board specific and need to match the SPI controller and chip select number you've connected the ade7880 to. For more information on this read the DECLARE SLAVE DEVICES section in the Linux kernel SPI documentation.

    - Lars

  • 0
    •  Analog Employees 
    on Nov 26, 2012 4:39 PM over 7 years ago


    The driver uses MODULE_DEVICE_TABLE, which sort of creates a MODULE_ALIAS for each driver in the device table. And as far as I can see it does include meter.h at least the main driver file ("ade7854.c"). The ade7854-spi.c doesn't need it since it only implements the SPI access and lets ade7854.c handle all the device logic.

    - Lars

  • I will double check my board config, I did look at that and thought I had it in there.

    Another question I had looking at the source for the ade7854 driver is that I noticed it doesn't include meter.h (which seems to define a lot of the device attributes for these boards) and that it doesn't include the MODULE_ALIAS macro at the end. I noticed some of the other drivers have those, so was just wondering if this was an oversight or if it's correct?