2008-10-10 02:49:42 Audio and Sport on BF537-Ezkit
Daniele Pagani (ITALY)
Message: 63370
Dear guys,
I want to use audio on BF537-Ezkit, so I think to use two ways:
1) writing audio driver by myself
2) using Sport driver and gpio driver
I'm newbie to embedded Linux, so, at the moment, I prefer to choose option 2).
Then, I compile the kernel with SPORT driver support ad with GPIO driver support.
I need to deselect SPI driver support, due to the conflict with pin PF12 (GPIO12).
Then, I take the sport_test.c software and I change something in order to use it on BF537-Ezkit.
In attachment I post the source code.
bfin_sport.h
sport_test.c
TranslateQuoteReplyEditDelete
2008-10-10 02:54:05 Re: Audio and Sport on BF537-Ezkit
Daniele Pagani (ITALY)
Message: 63371
(second part)
Then, if you connect the audio-in connector with some audio signal, then you can have the same signal on the audio-out connector.
However, I've problem with the sound, that is not ok.
So, to understand the problem, I change the BUF_LEN setting, and I set it to a big number. So I've uderstood the problem, that is I loose audio buffer.
I know how reach the result with Vdk, but I want to reach it also under Linux.
I've two idea:
1) the first is to use thread instead single program; I use pthread_create and so on (I put in one thread the audio input function and in another thread the audio output function), but the result is the same.
2) in my opionion I need to rewrite the sport driver, because, for audio talkthrough, in Vdk, I need to use dma 2d transfer.
So, any suggestion about the matter?
Best regards,
Daniele.
TranslateQuoteReplyEditDelete
2008-10-10 09:42:36 Re: Audio and Sport on BF537-Ezkit
Daniele Pagani (ITALY)
Message: 63413
Then,
I've done some additional tests.
I go in /sys/kernel/debug/blackfin/DMA Controller and I find that:
DMA3_CONFIG 0x00aa (--> switch to 0x00ab of course)
so, at the moment, the DMA is not configured to use DMA 2D transfer.
When I use VDK, if I want to use a block of samples and not one sample, I need to use DMA2D transfer, in order to use one buffer when DMA is writing on the other buffer.
How can I configure this behaviour with this sport driver?
During execution of the software:
DMA3_CONFIG : 0x00aa --> 0x00bb
DMA3_X_COUNT: 0x4000 (or 0x1000 it dependes by BUF_LEN)
DMA3_X_MODIFY 0x0004 (I use 24 bit wordlen)
DMA3_Y_COUNT 0x5696 (it has no sense because the software doesn't use 2d)
DMA4_CONFIG : 0x00a8
DMA4_X_COUNT: 0x4000 (or 0x1000 it dependes by BUF_LEN)
DMA4_X_MODIFY 0x0004 (I use 24 bit wordlen)
SPORT0_RCR1 0x4401
SPORT0_RCR2 0x0217
SPORT0_TCR1 0x4401
SPORT0_TCR2 0x0217
IMASK 0x0000ffff
IPEND 0x00008000
Best regards,
Daniele.
TranslateQuoteReplyEditDelete
2008-10-10 09:54:39 Re: Audio and Sport on BF537-Ezkit
Robin Getz (UNITED STATES)
Message: 63415
Daniele:
I think people had reported that the standard AD1836 I2S driver works OK as a audio driver on the EZKits. Did you try that?
-Robin
QuoteReplyEditDelete
2008-10-10 10:03:48 Re: Audio and Sport on BF537-Ezkit
Daniele Pagani (ITALY)
Message: 63416
Dear Robin,
the standard Ad1836 I2S driver works fine for audio output and I can not use it for audio input; I know that BF537-Ezkit is different from BF537-STAMP for audio driver.
Then, please, consider that I need to develop a board in professional audio, so I prefer to understand the Sport driver, in order to develop our driver.
Our board will keep audio input, do some alghoritms (filtering, ecc...) and then put data from audio output.
Today the ezkit board has Ad1854 and Ad1871, but, in our application, we'll use different A/D and D/A, so I need to understand exactly the matter.
Anyway, thank you very much for your suggestion, I'll see the code for Ad1836.
Best regards,
Daniele.
TranslateQuoteReplyEditDelete
2008-10-10 10:34:11 Re: Audio and Sport on BF537-Ezkit
Robin Getz (UNITED STATES)
Message: 63420
Daniele:
Audio driver in Linux are a little tricky. - the best thing to do is to check out the existing drivers, and modify them to meet your needs.
Also - we can help - if you pick the right ADC/DAC/Codec - how many channels of input/output do you need?
https://www.analog.com/en/digital-to-analog-converters/audio-da-converters/products/index.html
https://www.analog.com/en/analog-to-digital-converters/audio-ad-converters/products/index.html
https://www.analog.com/en/audiovideo-products/audio-codecs/products/index.html
-Robin
QuoteReplyEditDelete
2008-10-10 10:57:44 Re: Audio and Sport on BF537-Ezkit
Daniele Pagani (ITALY)
Message: 63425
Dear Robin,
at the moment I have the BF537 Ezkit:
AD1854 DAC
AD1871 ADC
So, 2 channels input and 2 channels output.
Then, on our board, I need only to change the pin for Audio Reset, so will change the GPIO12 to another pin, but this is not so important. And, on our board, I'll use also SPORT1 for additional 2 channel output (for me 1 channel=1 mono channel).
So, now, I want to keep audio from SPORT0 connected to AD1871 and send sound to SPORT0 by ad1854.
Please, consider that I develop the same project with VDK and it works fine. But, for different reasons (I'll explain them), I want to develop the same project under ucLinux.
Best regards,
Daniele.
TranslateQuoteReplyEditDelete
2008-10-10 13:22:25 Re: Audio and Sport on BF537-Ezkit
Robin Getz (UNITED STATES)
Message: 63439
Daniele:
I know what is on an EZKit - it is just that I don't care that much about that specific platform. What are you going to use in production?
QuoteReplyEditDelete
2008-10-13 08:25:17 Re: Audio and Sport on BF537-Ezkit
Daniele Pagani (ITALY)
Message: 63556
Dear Robin,
in production my idea is to use:
TI PCM 1798 D/A
TI PCM 4202 A/D
But, the problem is not what we'll use or not. This because I've yet tested these converters with BF537-EZKIT and with VKD project and all works fine.
My idea is not exactly to develop audio driver, because I don't need to run "audio" application.
Instead, I develop our application and I need "only" Sport driver.
That is,
I come from VDK philosophy and all works fine (I've developed project also with Sharc 21369); then I need a very stable a flexible tcp/ip stack, and, in my personal opinion, lw-ip and so on are not so good.
Now, I can not explain you the project, but, believe me, I need Linux Ethernet stack.
So, I've thinked 2 ways:
1) develop all audio manager in "special" (my own) driver --> I develop a driver in which I have the "talkthrough" audio and by ioctl fuction I change the parameters of the audio alghorim (example gain, frequency of the filter and so on).
Kernel-space --> sport,dma,interrupt, buffer in --> audio alghoritm (filtering) --> buffer out
User-space --> ethernet proprietary protocol --> ioctl to special driver in order to change audio alghoritm parameters
2) use good sport driver and develop audio alghoritm in userspace
Kernel-space --> gpio driver (for audio mute and so on...), sport driver
User-space --> read sport driver, audio alghoritm on this buffer --> write sport driver.
My problem, now, is that I don't understand why the audio doesn't work fine with this sport driver.
What I suppose is that I'm not using 2dimensional dma transfer.
Then, if somebody could develop driver for Ezkit, then I can use the same driver also for our project (I'll change the pin for mute/unmute converter).
Any considerations?
Best regards,
Daniele.
TranslateQuoteReplyEditDelete
2008-10-13 11:26:31 Re: Audio and Sport on BF537-Ezkit
Robin Getz (UNITED STATES)
Message: 63564
Daniele:
Audio in Linux is not a good starting place if you are not familiar with the way that Linux works.
There are two places to look - (1) the various audio drivers - including a basic I2S driver for the AD1836, and (2) a generic char sport driver (in ./drivers/char/bfin_sport.c )
-Robin
QuoteReplyEditDelete
2008-10-13 11:35:19 Re: Audio and Sport on BF537-Ezkit
Henrik Karlsson (SWEDEN)
Message: 63565
Hello Daniele,
Im not sure if I exactly understand your needs, but if you just want audio to work with the BF537 EZ, here is a Quick and Dirty solution:
1. Edit the sound/blackfin/ad1836.c file. In the init of the driver, there is a check if the DAC is connected (via SPI). Since the AD1854 SPI pins arent connected, comment this line. Also comment the lines in set and read register.
2. When enabling the audio with make menuconfig, make sure you choose I2S interface.
3. make, download and enjoy your music!
// Henrik