How use this driver....ADE7753 or similar

Hi, I need help about to use the driver ADE7753.c or similar,

I want use it in my Beaglebone, steps that I followed:

1) compile the kernel with file .confg adapted, (CONFIG_ADE7753=m), and I used it in my beaglebone

2) I created the module ade7753.ko

3) I copied it to /lib/modules/3.2.18/kernel/drivers/staging/iio/meter in my beaglebone

4) insmod ade7753.ko (install this module in the kernel)

-How can I read & write the register of this IC (ADE7753), with the driver?

But I don’t know how use this module in my application (C code),

do somebody have any code © or idea how can I use that driver?

I need start and I’m missing with this project. I’m not expert in Linux, I’m interested about document of this subject (use driver and module at user level).

Thank you in advance.

Thank you for your time and advance.

Hi, I need help about to use the driver ADE7753.c or similar,

I want use it in my Beaglebone, steps that I followed:

1) compile the kernel with file .confg adapted, (CONFIG_ADE7753=m), and I used it in my beaglebone

2) I created the module ade7753.ko

3) I copied it to /lib/modules/3.2.18/kernel/drivers/staging/iio/meter in my beaglebone

4) insmod ade7753.ko (install this module in the kernel)

-How can I read & write the register of this IC (ADE7753), with the driver?

But I don’t know how use this module in my application (C code),

do somebody have any code © or idea how can I use that driver?

I need start and I’m missing with this project. I’m not expert in Linux, I’m interested about document of this subject (use driver and module at user level).

This driver exposes the registers in the sys file system. Go to /sys/bus/iio/device/devicexx/ and there you will see all the registers for the ADE7753. Use cat to display the registers and echo to write to the registers.

Regards,

John

Thank you in advance.

Thank you for your time and advance.

Thank you John,

but I can't find these files, I understand the method, only with the
command "insmod ade7753.ko" I must find these files, is it true?

I think something is wrong.....if the IC ADE7513 is not wire, can I
find these files?

Do you tell me if there is some document or link where I can find
information about these drivers?

From: beagleboard@googlegroups.com [mailto:beagleboard@googlegroups.com]
On Behalf Of Antonio Garcia Oteros
Sent: Monday, October 01, 2012 2:00 PM
To: beagleboard@googlegroups.com
Subject: Re: [beagleboard] How use this driver....ADE7753 or similar

Thank you John,

but I can't find these files, I understand the method, only with the

command

"insmod ade7753.ko" I must find these files, is it true?

I think something is wrong.....if the IC ADE7513 is not wire, can I find

these files?

Do you tell me if there is some document or link where I can find

information

about these drivers?

Hi Antonio,

I thought this was going to happen. If the device was connected correctly,
the driver would have loaded automatically and you would see warnings
because these drivers are in the staging folder. First you need to make sure
you have setup the SPI interface in your board file. Most important is this
{
.modalias = "ade7753",
.bus_num = 3,
.chip_select = 0,
.max_speed_hz = 10000000,
.controller_data = &ade7753_spi_chip_info
}
I'm assuming spi channel 3, chip select 0 and 10MHz speed. If you have this
setup correctly, then you will need a protocol analyzer or oscilloscope to
see if the comms are working. Could be a mux problem on the SPI pins.

One other thing you may want to check. I2C and SPI comms return -1 for
error, but they return the number of bytes if successful. These drivers did
something like this:

return ret ? ret : len;

This is wrong and you need to change it to:

return (ret < 0) ? ret: len;

Regards,
John

>
>
> From: beagleboard@googlegroups.com
> [mailto:beagleboard@googlegroups.com] On Behalf Of Antonio Garcia
> Oteros
> Sent: Monday, October 01, 2012 7:16 AM
> To: beagleboard@googlegroups.com
> Subject: [beagleboard] How use this driver....ADE7753 or similar
>
>
>
> Hi, I need help about to use the driver ADE7753.c or similar,
>
> I want use it in my Beaglebone, steps that I followed:
>
>
>
> 1) compile the kernel with file .confg adapted, (CONFIG_ADE7753=m),
> and I used it in my beaglebone
>
> 2) I created the module ade7753.ko
>
> 3) I copied it to /lib/modules/3.2.18/kernel/drivers/staging/iio/meter
> in my beaglebone
>
> 4) insmod ade7753.ko (install this module in the kernel)
>
>
>
> -How can I read & write the register of this IC (ADE7753), with the

driver?

I have problems with building the kernel, I have followed your steps,
1) in the file /match-omap2/board-am335xevm.c add this

static struct spi_board_info bone_ade7753_info = {
  {
    .modalias = "ade7753",
    .bus_num = 2,
    .chip_select = 0,
    .max_speed_hz = 100000,
    .controller_data = &ade7753_spi_chip_info
  },
};

When I complied the kernel I get this error,

arch/arm/mach-omap2/board-am335xevm.c:2025:23: error:

'ade7753_spi_chip_info' undeclared here (not in a function)

, don't find ade7753_spi_chip_info...¿?

Do you know how must I compile that kernel, I know that something is
wrong im my files.....

I have the driver's files in: /drivers/staging/iio/meter

Do you know where is defined that structure "ade7753_spi_chip_info" to
avoid that compiling mistake?

Which are the steps that I shoud follow?

Thank you.

From: beagleboard@googlegroups.com [mailto:beagleboard@googlegroups.com]
On Behalf Of Antonio Garcia Oteros
Sent: Thursday, October 04, 2012 7:17 AM
To: beagleboard@googlegroups.com
Subject: Re: [beagleboard] How use this driver....ADE7753 or similar

I have problems with building the kernel, I have followed your steps,
1) in the file /match-omap2/board-am335xevm.c add this

static struct spi_board_info bone_ade7753_info = {
  {
    .modalias = "ade7753",
    .bus_num = 2,
    .chip_select = 0,
    .max_speed_hz = 100000,
    .controller_data = &ade7753_spi_chip_info

    .mode = SPI_MODE_1,

  },
};

When I complied the kernel I get this error,

> arch/arm/mach-omap2/board-am335xevm.c:2025:23: error:
'ade7753_spi_chip_info' undeclared here (not in a function)

, don't find ade7753_spi_chip_info...¿?

You have to define this in your board file. It is probably defined like this

static struct omap2_mcspi_device_config _spi_chip_info = {
  .turbo_mode = 0,
  .single_channel = 1, // 0: Slave, 1: Master
};

What you need to do is look at how the other SPI interfaces are defined and
do the same for your device. Notice that I also added a line to the struct
above to set the SPI mode. You need to look at the datasheet to see what
mode you need.

Regards,
John

Do you know how must I compile that kernel, I know that something is wrong

im

my files.....

I have the driver's files in: /drivers/staging/iio/meter

Do you know where is defined that structure "ade7753_spi_chip_info" to

avoid