2011-07-06 11:04:06     Help with ad525x_dpot needed

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-07-06 11:04:06     Help with ad525x_dpot needed

Peter Lindner (AUSTRIA)

Message: 102169   

 

hi there...

 

currently i'm stuck in getting the ad525x_dpot driver to work. i'm using a custom board in combination with cm-bf527 from bluetechnix.

 

so these are the steps i've currently done:

 

- i have an AD5293 digital potentiometer conntected to the spi port. CS is hooked to SPISEL1.

 

- i have ad525x_dpot compiled into the kernel

 

- in cm-bf527.c i have inserted following lines:

 

      #if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)

        static struct bfin5xx_spi_chip spi_ad_dpot_chip_info = {

        .enable_dma = 0,

        .bits_per_word = 16,

        };

     #endif

 

   static struct spi_board_info bfin_spi_board_info[] __initdata = {

   #if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)

    {

        .modalias = "ad_dpot",

        .platform_data = "ad5293",

        .max_speed_hz = 5000000,     /* max spi clock (SCK) speed in HZ */

        .bus_num = 0,

        .chip_select = 1,

        .controller_data = &spi_ad_dpot_chip_info, /* only needed on Blackfin */

                .mode = SPI_MODE_1,

    },

  #endif

 

 

 

- it seems that spi and driver are correctly initialized during boot:

    bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

   ad_dpot spi0.1: ad5293 1024-Position Digital Potentiometer registered

 

but if i try to set the wiper by writing a value with echo to /sys/bus/spi/devices/spi0.1/rdac0 nothing is sent over the spi (checked with oszilloscope) and i get following debug output:

 

Jan 24 10:47:48 blackfin user.debug kernel: ad_dpot spi0.1: adding an msg in transfer()

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: restoring spi ctl state

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: got a message to pump, state is set to: baud 15, flag 0x200, ctl 0x1

400

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: the first transfer len is 1

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: tx_buf is 01525e2c, tx_end is 01525e2d

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: transfer: drv_data->ops is 001d22b4, chip->ops is (null), u8_ops is

001d22a8

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: now pumping a transfer: width is 256, len is 1

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: doing IO transfer

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: IO write: cr is 0x5500

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: IO write error!

Jan 24 10:47:48 blackfin user.debug kernel: bfin-spi bfin-spi.0: transfer: we've hit an error

 

 

 

does anyone have an idea what is going wrong here?

 

thanks for your help

 

regards peter

TranslateQuoteReplyEditDelete

 

 

2011-07-06 11:27:59     Help with ad525x_dpot needed

Michael Hennerich (GERMANY)

Message: 102170    Try to not set .bits_per_word = 16.

This will default to bits_per_word = 8.

Just a guess - It might be a bug in the Blackfin SPI bus driver, if you

transfer 1 byte using bits_per_word = 16....

 

Anyways the dpot driver expects the default bits_per_word which is 8.

 

-Michael

QuoteReplyEditDelete

 

 

2011-07-06 12:27:17     Re: Help with ad525x_dpot needed

Peter Lindner (AUSTRIA)

Message: 102171   

 

hello...

 

actually i tried using bits_per_word=8 although my poti needs 16bit transfer...

 

now i get debug output without error message... but no output on spi is done...

 

Jan 24 11:23:08 blackfin user.debug kernel: ad_dpot spi0.1: adding an msg in transfer()

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: restoring spi ctl state

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: got a message to pump, state is set to: baud 15, flag 0x200, ctl 0x1

400

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: the first transfer len is 1

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: tx_buf is 01525e2c, tx_end is 01525e2d

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: transfer: drv_data->ops is 001d22a8, chip->ops is (null), u8_ops is

001d22a8

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: now pumping a transfer: width is 0, len is 1

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: doing IO transfer

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: IO write: cr is 0x5400

Jan 24 11:23:08 blackfin user.debug kernel: bfin-spi bfin-spi.0: transfer: all done!

 

 

 

can you give me a hint, how to test the driver? i'm not sure if i deal correctly with the sysfs entry...

 

thank you for your help

 

peter

TranslateQuoteReplyEditDelete

 

 

2011-07-07 03:38:18     Re: Help with ad525x_dpot needed

Michael Hennerich (GERMANY)

Message: 102213    For more information on the dpot driver check this page:

  wiki.analog.com/resources/tools-software/linux-drivers/misc/dpot

 

However when seeing debug messages like this I would assume that you see

at least 8 clocks on the SPI CLK signal.

If you don't, check your cabling, switches, etc.

 

Make sure that the same SPI works with other drivers, such as spidev.

 

-Michael

QuoteReplyEditDelete

 

 

2011-07-07 03:58:08     Re: Help with ad525x_dpot needed

Peter Lindner (AUSTRIA)

Message: 102214   

 

thank you for your hint...

 

this morning i started trying with spidev... same issue

 

maybe it's really a contact issue on the board...

 

got to check this...

 

regards

 

peter

TranslateQuoteReplyEditDelete

 

 

2011-07-07 06:40:50     Re: Help with ad525x_dpot needed

Peter Lindner (AUSTRIA)

Message: 102215   

 

hello...

 

it seems that there was a contact problem... now spi functions...

 

but i noticed, there is a delay of ca. 200us between CS-low and begin of CLK and DATA

 

does anybody have an idea what causes this delay?

 

regards

TranslateQuoteReplyEditDelete

 

 

2011-07-07 11:50:41     Re: Help with ad525x_dpot needed

Mike Frysinger (UNITED STATES)

Message: 102219   

 

the CS is driven by software, and software isnt fast

Attachments

    Outcomes