I'm new to the Blackfin. I'm trying to get the SPORT0 to work on portG and I'm not having any luck getting it to communicate.
I want PG6 to be DT0PRIA, PG10 to be TSCLK0 and PG15 to be TFS0A
Here's my initialization code:
// set up PORTG as SPORTs
// PG6(DT0PRIA) = first function
// PG10(TSCLK0) = first alternate function
// PG15(TFS0A) = first function *pPORTG_MUX &= 0x0CF3;
*pPORTG_MUX |= 0x100;
*pPORTGIO_DIR |= 0x8440;
// configure as peripheral NOT GPIO
*pPORTG_FER |= 0x8440;
// Make sure port disabled
*pSPORT0_TCR1 = 0;
// Sport0 transmit configuration
// Alternate Framing Mode, Internal clock, active low framing
// internal frame sync, frame sync for each write
*pSPORT0_TCR1 = LATFS | ITCLK | LTFS | ITFS | TFSR;
// 16-bit data, Secondary side enable, Stereo frame sync enable
*pSPORT0_TCR2 = SLEN_16;
*pSPORT0_TFSDIV = 31; // from sample code - will adjust when I figure this out better what I want
*pSPORT0_TCLKDIV = 1;
// Enable Tx
*pSPORT0_TCR1 |= TSPEN;
The status register shows 0x0040 (transmit hold register empty) and so when I try to write out to the transmit data register, I don't see anything on my scope.
*pSPORT0_TX = 0x6F3;
I do have an awful looking triangle wave of about 25MHz with a magnitude of about 1.28V on the TSCLK0A line. I would expect that line to toggle only when I'm trying to send data.
I'm probably missing something very obvious. I'm using the EZ-Kit for the BF52x and used the sample code that came wth. I didn't find anything in the search that answered this, but my apologies if there was and I missed it.
According to the DDS that I'm using (AD5932) it wants to have the following conditions on the SPORT channel:
Internal clock operation, active low framing, 16 bit word length, internal frame snc signal generate frame sync for each write and alternate framing mode.