I am using an LPC4367JET100 on an LPCXpresso4367 to output data using SGPIO. Excluding the rest of my project so that I can solely test the SGPIO, I made a simple program that outputs a 32 bit word of alternating bits (0xAAAAAAAA) continuously over SGPIO in order to allow me to test my outputs using a multi-meter. Since this signal should be equivalent to an average of half the VCC, it should be 1.65v at the pins.
In the code attached below, SGPIO slice B is outputting to SGPIO pin 8 which corresponds to the P1_12 physical pin. On this pin, I get the 1.65v output and I can change it too by using different register values, proving that it works. The problem is the 5 other pins that I need to function do not seem to output this 1.65v (0xAAAAAAAA). The documentation for SGPIO is very confusing but I believe this is how the pins are muxed internally for 1 bit mode:
SGPIO slice B -> SGPIO pin 8 -> physical pin P1_12 (SCU function 6 this one works but none of the others seem to)
SGPIO slice L -> SGPIO pin 7 -> physical pin P2_6 (SCU function 0)
SGPIO slice M -> SGPIO pin 9 -> physical pin P1_13 (SCU function 6)
SGPIO slice N -> SGPIO pin 11 -> physical pin P1_4 (SCU function 2)
SGPIO slice O -> SGPIO pin 13 -> physical pin P2_4 (SCU function 0)
SGPIO slice F -> SGPIO pin 6 -> physical pin P2_2 (SCU function 0)
Please correct me if I am wrong on understanding how the SGPIO slices mux internally. P1_13 is a specific one which did not work where I tried switching the SCU pin function to every possible value and on none did I get any 1.65v output. I also decided to check all the pins available to me on the board in case I was checking the wrong pins but no other pins had this 1.65v /were controllable via SGPIO slice.
Thank you for looking into this.
Solved! Go to Solution.
The way you use GPIO_OENREG is wrong. You need to set the bits for all outputs simultaneously. The way you do it one after another, previously set bits become cleared again and the outputs become disabled.
The last one is line 251:
LPC_SGPIO->GPIO_OENREG = (1 << 8); //enable pin 8
After that only bit 8 is set, so only output 8 works.
The way you use GPIO_OENREG is wrong. You need to set the bits for all outputs simultaneously. The way you do it one after another, previously set bits become cleared again and the outputs become disabled.
The last one is line 251:
LPC_SGPIO->GPIO_OENREG = (1 << 8); //enable pin 8
After that only bit 8 is set, so only output 8 works.
Thank you very much! I knew I was missing something simple.