lpcware

Simple SGPIO test program isn't working as expected

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by jgorsk on Fri Oct 05 07:42:57 MST 2012
I'm trying learn how to use the SGPIO, I wrote a simple test program
and I expected to see 8 clock pulses at SGPIO9 and SGPIO13 outputs
(OUT_MUX_CFG = 0x08).
Instead I'm getting serial bit patterns as specified by REG
register contents.

What am I doing wrong in the following example?


LPC_RGU -> RESET_CTRL1 = (LPC_RGU->RESET_ACTIVE_STATUS1) | (1 << 25); // reset the SGPIO block

LPC_SGPIO -> OUT_MUX_CFG[9] = 0x00000008;//SPGIO9 is clk_out
LPC_SGPIO -> OUT_MUX_CFG[13] = 0x00000008;//SPGIO13 is clk_out

LPC_SGPIO -> SLICE_MUX_CFG[12] = 0x00000000;//slice M
LPC_SGPIO -> SLICE_MUX_CFG[14] = 0x00000000;//slice O

LPC_SGPIO -> SGPIO_MUX_CFG[12] = 0x00000000;//Slice M
LPC_SGPIO -> SGPIO_MUX_CFG[14] = 0x00000000;//Slice O



LPC_SGPIO -> CTRL_ENABLED  &= ~((1 << 12) | (1 << 14));
LPC_SGPIO -> CTRL_DISABLED &= ~((1 << 12) | (1 << 14));


LPC_SGPIO -> GPIO_OENREG |= (1 << 9) | (1 << 13); //SGPIO9 and 13 are active outputs

LPC_SGPIO -> REG[12] = 0x00000050;
LPC_SGPIO -> REG[14] = 0xffffff0f;

LPC_SGPIO -> REG_SS[12] = 0xffffffff;
LPC_SGPIO -> REG_SS[14] = 0xffffffff;

LPC_SGPIO -> PRESET[12] = 16;
LPC_SGPIO -> PRESET[14] = 16;

LPC_SGPIO -> COUNT[12] = 16;
LPC_SGPIO -> COUNT[14] = 16;

LPC_SGPIO -> POS[12] = 0x00000808;
LPC_SGPIO -> POS[14] = 0x00000808;

LPC_SGPIO -> CTRL_ENABLED  |= (1 << 12) | (1 << 14);
LPC_SGPIO -> CTRL_DISABLED |= (1 << 12) | (1 << 14);

Outcomes