2011-04-28 15:01:03 bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100268
hi there....
first of all i've got to say that i'm a real noob in using blackfin dsp with uclinux...
i have a cm-bf527 from bluetechnix and i try to talk to my AD7304 DAC over the bfin SPORT.
as i found out, i can use the bfin_sport driver (Blackfin SPORT driver for direct raw access) for fullfilling my needs (finally i want to generate a sine-wave with DMA using a lookup table).
for the beginning i decided just to put out some values in PIO mode... i think opening and configuring the sport works (for example clock signal has the right frequency)...
with an oscilloscope i can observe, that clock signal and framesync signals are put correctly.... but no data are sent (or only FF)...
here is my user-space test program
what i'm doing wrong here? after really long time of trying to debug i'm really helpless at the moment...
thank you for your help
peter
int main(int argc, char *argv[])
{
struct sport_config config;
char *sport_path, *data;
int16_t sport_data;
int i;
sport_path=DEFAULT_SPORT;
sport_fd = open(sport_path, O_RDWR, 0);
if (sport_fd < 0)
printf("failed to open %s\n", sport_path);
memset(&config, 0, sizeof(struct sport_config));
config.mode = NORM_MODE; //
config.fsync = 1; // frame sync required
config.word_len = 16;
config.data_indep = 0; // Data independed frame syncs
config.int_clk=1; // internal clock
config.dma_enabled = 0;
config.late_fsync=1;
config.lsb_first=0;
config.act_low=1;
config.tckfe=0;
config.sec_en=0;
config.serial_clk=50000;
config.data_format=NORM_FORMAT; /*Normal, u-law or a-law */
/* Configure sport controller by ioctl */
if (ioctl(sport_fd, SPORT_IOC_CONFIG, &config) < 0)
printf("ioctl('%s', SPORT_IOC_CONFIG) failed", sport_path);
ad7304_enable();
data=DEF_DATA;
char data_array [] = {0xAA,0xBB,0xCC,0xDD,0xEE,0xFF};
while (0<1)
{
i=write(sport_fd, data_array,4);
usleep(5000);
}
close(sport_fd);
gpio_unexport(15);
return 0;
}
TranslateQuoteReplyEditDelete
2011-04-28 22:46:10 Re: bfin sport write failure
Aaron Wu (CHINA)
Message: 100273
You may turn on the pr_debug option to see what happens in the sport driver.
QuoteReplyEditDelete
2011-04-29 00:09:44 Re: bfin sport write failure
Sonic Zhang (CHINA)
Message: 100274
Which release do you use? 2010R1? As Aaron mentioned, please post the debuging message from bfin_sport driver here.
QuoteReplyEditDelete
2011-04-29 02:37:47 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100276
hello...
thank you for your answers...
i already saw the pr_debug messages in the driver sources... but (as i mentioned that i'm new in uclinux) i didn't find, where to turn on and read out this debug messages... (unfortunately i find the wiki really unhelpful)
can you help me also with this topic?
thank you for your patience and for your help
peter
TranslateQuoteReplyEditDelete
2011-04-29 02:41:39 Re: bfin sport write failure
Aaron Wu (CHINA)
Message: 100277
To enable the pr_debug information you may set some CFLAGS for example by adding a line like" CFLAGS_bfin_sport.o := -DDEBUG" in the end of drivers/char/Makefile, then use dmesg to view the debug info
QuoteReplyEditDelete
2011-04-29 10:17:41 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100295
hello...
now i managed to enable debug-output... a single write attempt ( write(sport_fd, data_array,2); ) produces the folowing output within dmesg:
bfin_sport: registered sport0
bfin_sport: registered sport1
bfin_sport: sport_open enter
bfin_sport: sport_ioctl: enter, arg:0x43def0
bfin_sport: tcr1:0x3602, tcr2:0xf, rcr1:0x3602, rcr2:0xf
mcmc1:0x0, mcmc2:0x0
bfin_sport: sport_write count:2 dma_tx_chan:6
bfin_sport: sport_tx_handler: stat:0
bfin_sport: sport_tx_handler: stat:0
bfin_sport: sport_tx_handler: stat:0
bfin_sport: sport_tx_handler: stat:0
bfin_sport: sport_tx_handler: stat:0
bfin_sport: sport_tx_handler: stat:0
bfin_sport: sport_tx_handler: stat:40
bfin_sport: wait for transfer finished
bfin_sport: waiting over
bfin_sport: sport_release enter
bfin_sport: sport_tx_handler: stat:40
thank you for your help...
peter
TranslateQuoteReplyEditDelete
2011-04-29 11:07:49 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100296
as i forgot to mention... currently i'm using 2010R1 release...
greets
peter
TranslateQuoteReplyEditDelete
2011-04-30 11:48:51 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100324
no i've encountered a strange behaviour of the controller...
if i use the write function write(sport_fd, data_array,2); then nothing is sent and i got the oscilloscope picture
oscope_16bit_2word_write.png
but if i use write(sport_fd, data_array,3); then i recognize, that something is sent over the sport (BBAA) which seems to be right... i get following screen...
does anybody see the error here? i only want to send 2 bytes to my DAC...
can anybody help me?
greets peter
TranslateQuoteReplyEditDelete
2011-05-02 11:10:31 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100341
nobody out there who can help me?
greets peter
TranslateQuoteReplyEditDelete
2011-05-02 22:28:57 Re: bfin sport write failure
Aaron Wu (CHINA)
Message: 100348
What's the waveform in your first picture, is it a single pulse? or a series of pulses? Can not see clearly what's the timediv is from the picture.
QuoteReplyEditDelete
2011-05-03 04:14:46 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100364
hello aaron...
this is the waveform of a single write-attempt...
the white curve is the framesync signal, the purple one is the DTPRI1 line...
timediv in the first picture is 1ms
for me it seems that somehow the controller looses its configuration... for example, i've configured the controller for active low framesync... this is an active high framesync isn't it?
thank you for your help
greets peter
TranslateQuoteReplyEditDelete
2011-05-03 04:44:29 Re: bfin sport write failure
Aaron Wu (CHINA)
Message: 100366
If the time div for both picture are the same, the main diffrence I can see is there is some data pulses in picture 2 while there is not in picture one. Since you can inspect the reg value and data rx tx interrupt status with the log turning on, you may go on to dig more. I can have a try some other time on my side.
QuoteReplyEditDelete
2011-05-03 05:09:36 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100369
nope... timedivs are not the same... in the first picture there are 1ms... in the second pic 0,1ms...
TranslateQuoteReplyEditDelete
2011-05-03 05:17:48 Re: bfin sport write failure
Aaron Wu (CHINA)
Message: 100370
That's why I asked is it a single pulse or a series of pulses, I guess it's the later, turn the time dive to 0.1 for double check please, if it's true then there are data outputs as expected.
QuoteReplyEditDelete
2011-05-03 06:45:49 Re: bfin sport write failure
Peter Lindner (AUSTRIA)
Message: 100373
no... thats not a single pulse on the first picture....
thats the whole communication... you can see this on comparing the framesync signals from first and second picture...
the framesync should go low on begin of transfer, remain 0 during transfer of databytes and go high again after desired count of bits sent on the dataline... as it do on the second picture...
also if i turn to 1ms i can not see any levelchanges on the data line...
thanks for your help