2010-11-09 09:34:31     SPORT TDM mode

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

2010-11-09 09:34:31     SPORT TDM mode

Roman Merz (SWITZERLAND)

Message: 95703   

 

Hello,

 

I would like to read some values from an external A/D converter using the SPORT in TDM mode on a BF527. The clock source and the frame-sync are provided externally. The `Blackfin SPORT driver for direct raw access' is enabled (linux-2.6.x/drivers/char/bfin_sport.c) and the pr_debug messages are switched on.

 

The test application is based on the `common sport test' (user/blkfin-test/sport_test/sport_test.c) with the parts relevant for the GPIO4 and the AD73311L removed.

 

When configuring the test application, such that the SPORT operates in normal mode, the acquisition of one channel works flawlessly and all the samples are written into a file.

 

  memset(&config, 0, sizeof(struct sport_config));

  config.mode = NORM_MODE;

  config.data_format = NORM_FORMAT;

  config.fsync = 1;

  config.act_low = 1;

  config.int_clk = 0;

  config.word_len = 24;

  config.dma_enabled = 1;

  config.tckfe = 0;

  config.lsb_first = 0;

  config.late_fsync = 0;

  config.sec_en = 0;

      

  /* Configure sport controller by ioctl */

  if (ioctl(sport_fd, SPORT_IOC_CONFIG, &config) < 0)

    errp("ioctl('%s', SPORT_IOC_CONFIG) failed", sport_path);

 

When configuring the TDM mode as follows, the acquisition never finishes,

because the driver does not receive any DMA RX IRQ.

 

  memset(&config, 0, sizeof(struct sport_config));

  config.mode = TDM_MODE;

  config.data_format = NORM_FORMAT;

  config.fsync = 1;

  config.act_low = 1;

  config.int_clk = 0;

  config.word_len = 24;

  config.dma_enabled = 1;

  config.tckfe = 0;

  config.lsb_first = 0;

  config.late_fsync = 0;

  config.sec_en = 0;

 

  config.channels = 8;

  config.frame_delay = 0;      

       

  /* Configure sport controller by ioctl */

  if (ioctl(sport_fd, SPORT_IOC_CONFIG, &config) < 0)

    errp("ioctl('%s', SPORT_IOC_CONFIG) failed", sport_path);

 

Thank you for hints to setup the TDM mode in SPORT or for instructions to debug the application.

 

kernel:    Linux release 2.6.36-ADI-2011R1-pre-svn9469

toolchain: bfin-linux-uclibc-gcc release gcc version 4.3.5 (ADI-trunk/svn-4957)

user-dist: release svn-9876

 

Best regards

Roman

QuoteReplyEditDelete

 

 

2010-11-09 23:26:23     Re: SPORT TDM mode

Aaron Wu (CHINA)

Message: 95719   

 

Could you post us the debug message when pr_debug is on?

QuoteReplyEditDelete

 

 

2010-11-10 02:42:24     Re: SPORT TDM mode

Roman Merz (SWITZERLAND)

Message: 95720   

 

Hello,

 

Sure, here are the debug messages. When comparing the values in the SPORT registers with the HRM, it seems okay for the selected mode.

 

root:/> dmesg

 

bfin_sport: sport_open enter

bfin_sport: sport_ioctl: enter, arg:0x53fda0

bfin_sport: tcr1:0x1400, tcr2:0x17, rcr1:0x1400, rcr2:0x17

mcmc1:0x0, mcmc2:0x1c, mrcs0:0xff

bfin_sport: sport_read count:4096

bfin_sport: DMA mode read

 

Still the BF527 does not receive an IRQ from the SPORT.

 

root:/> cat /proc/interrupts

  6:     161548      CORE  Blackfin CoreTimer

15:          0      INTN  bfin_sport-err

21:          1      INTN  rtc-bfin

23:          0      INTN  sport_rx_dma_chan

24:          0      INTN  sport_tx_dma_chan

27:          0      INTN  i2c-bfin-twi

31:          0      INTN  BFIN_UART_RX

32:         19      INTN  BFIN_UART_TX

35:        233      INTN  EMAC_RX

92:        231      GPIO  gpio-keys: BTN0

NMI:          0      CORE  Non Maskable Interrupt

Err:          0

 

The external signals seem correct and the SPORT receives the data correctly when the normal mode is used.

 

Thanks for your support and best regards

Roman

QuoteReplyEditDelete

 

 

2010-11-10 23:17:44     Re: SPORT TDM mode

Aaron Wu (CHINA)

Message: 95765   

 

Thanks for your information!

 

TDM mode for driver char/bfin_sport.c is not fully tested. However, in audio driver, the TDM function for SPORT has been tested, however it's for audio and can not meet your requirement for ADC, you may take the SPORT and TDM code there as reference for your debug (linux-2.6.x/sound/soc/blackfin/bf5xx-sport.c and bf5xx-tdm.c)

 

Meanwhile I will check the bfin_sport.c on my side

QuoteReplyEditDelete

 

 

2010-11-11 03:29:39     Re: SPORT TDM mode

Roman Merz (SWITZERLAND)

Message: 95772   

 

Hello,

 

thank you for the support.  Meanwhile I saw that the RX interrupts are received when the TX is enabled by setting TSPEN in TCR1.  This corresponds to the description of the multichannel mode in the HRM.  Hence, to read the SPORT in TDM mode, it seems required to

 

- make also a write call in the userspace application (for example sport_test.c) to enable TSPEN indirectly.

- modify the driver (bfin_sport.c), such that TSPEN is set.

 

I don't know which approach (or yet another one) should be preferred.  Is it be possible to switch off the TX interrupts and DMA handlers, even with TSPEN enabled?  In either case, I would appreciate a test application such as sport_tdm_test.c for the TDM mode - as much as I appreciate the already existing test applications.

 

Best regards

Roman

QuoteReplyEditDelete

 

 

2010-11-15 07:57:51     Re: SPORT TDM mode

Roman Merz (SWITZERLAND)

Message: 95849   

 

To keep track of potential solutions:  One approach to make the TDM mode working for read-only-access when using the bfin_sport.c driver is the following:

 

1] Enable TSPEN in the read function

2] Modify the calculations of the buffer size for the DMA

3] Ensure that the registers RCR1, RCR2, TCR1, and TCR2 are also set in TDM mode.

 

Regards

Attachments

    Outcomes