[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SSP in MASTER_BIDIR mode




----- Original Message ----- 
From: "Carlos Ojea" <carlosojea@xxxxxxx.es>
To: <dev-etrax@xxxxxxx.com>
Sent: Thursday, October 16, 2003 5:51 PM
Subject: SSP in MASTER_BIDIR mode


> 
> Hello:
> 
> When I configure SSP in MASTER_BIDIR mode my program runs very, very,
> slowly 
> and CLOCK_GATED does not work (master output mode works ok).
> 
> Here is part of my program:
> devspi = open ("/dev/syncser0", O_RDWR | O_SYNC | O_NONBLOCK);    
> ioctl (devspi, SSP_MODE, MASTER_BIDIR);  
> ioctl (devspi, SSP_FRAME_SYNC, FLOW_CONTROL_DISABLE);    
> ioctl (devspi, SSP_FRAME_SYNC, CLOCK_GATED);      

Just to be sure, try specifying all the possible options for the 
SSP_FRAME_SYNC in one call, e.g:

 tmp = NORMAL_SYNC | BIT_SYNC | SYNC_ON |
  WORD_SIZE_8 | BIT_ORDER_MSB | 
  FLOW_CONTROL_DISABLE | CLOCK_NOT_GATED;
 if (ioctl(fd, SSP_FRAME_SYNC, tmp)) {
  fprintf(stderr, "Couldn't change sync SSP_FRAME_SYNC\n");
  err++;
 }

and also set the other possible parameters to fit your device:

 tmp = CLOCK_INEGEDGE | FRAME_NORMAL | STATUS_NORMAL;
 if (ioctl(fd, SSP_IPOLARITY, tmp)) {
  fprintf(stderr, "Couldn't change polarity SSP_IPOLARITY\n");
  err++;
 }

 tmp = CLOCK_NORMAL | FRAME_NORMAL | STATUS_NORMAL;
 if (ioctl(fd, SSP_OPOLARITY, tmp)) {
  fprintf(stderr, "Couldn't change polarity SSP_OPOLARITY\n");
  err++;
 }
 /* 64 kHz, word_sync: 8 bits/sync, frame_sync: 1 (no framing) */
 if (ioctl(fd, SSP_SPEED, CODEC_VAL(FREQ_64kHz, 8, 1))) {
  fprintf(stderr, "Couldn't change sync SSP_SPEED\n");
 }
 /* 160 bytes (160 samples = 20 ms) buffering */
 if (ioctl(fd, SSP_INBUFCHUNK, 160)) {
  fprintf(stderr, "Couldn't change sync SSP_BUFCHUNK\n");
  err++;
 }

I'm not sure the CLOCK_GATED option do what you desire, 
but feel free to try it.

I assume you don't have enabled DMA, is that correct?



> Anybody knows why or have any clue?
> 
> Regards,
> Carlos

/Johan