2010-04-02 11:03:00     ndso demo: spidev vs spi_adc

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

2010-04-02 11:03:00     ndso demo: spidev vs spi_adc

Carlo Cloet (BELGIUM)

Message: 88038   

 

uClinux distribution 2009R1.1-RC4

BF537 EZkit-Lite

 

I am experimenting with the canned network scope demo as my first application. I had to make some modifications to make things work, so I would like to check if my changes indeed make sense (I am new to Linux device drivers).

 

The original ndso code accesses the ADC using "open("/dev/spi", O_RDWR)".

 

Initially, I followed the on-line docs and enabled

< > Blackfin ADSP SPI ADC support

when building my kernel. This did not result in a /dev/spi device, so the open call above would fail.

 

After checking the other listings in this forum, I selected

< > User mode SPI device driver support

instead and changed the code to "open("/dev/spidev0.1", O_RDWR)". I am still waiting for the actual ADC to put on my eval board, but at this point the code seems to run and the scope plots a nice flat line.

 

My questions:

1) I will be using the AD7476 ADC. Can I simply change the .bits_per_word to 16 in stamp.c as in

 

#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)

static struct bfin5xx_spi_chip spidev_chip_info = {

    .enable_dma = 0,

    .bits_per_word = 16,

};

 

to make this work? Or will I need any additional changes?

 

2) We eventually want to use DMA to acquire the ADC samples, so I would like to know whether this demo should have worked also with the

< > Blackfin ADSP SPI ADC support

kernel option (as that driver seems to be based on DMA).

 

Were my changes above indeed required or should the original code have worked? If so, what additional steps are needed to use the SPI_ADC driver?

 

Thanks in advance for the clarification.

TranslateQuoteReplyEditDelete

 

 

2010-04-02 12:49:32     Re: ndso demo: spidev vs spi_adc

Mike Frysinger (UNITED STATES)

Message: 88043   

 

the ndso code was designed for the SPI ADC driver, not spidev.  it is probably simple to port it over, but we havent done that.

 

that should be all you need for 16bit slaves

QuoteReplyEditDelete

 

 

2010-04-02 13:31:28     Re: ndso demo: spidev vs spi_adc

Carlo Cloet (BELGIUM)

Message: 88046   

 

Hi Mike,

I went through the kernel configuration again. Turns out I had included the SPI ADC driver as a module, instead of built-in. Now the original code works indeed. Glad I double-checked with you. Thanks for the help!

Carlo

Attachments

    Outcomes