Braintu Posted October 23, 2012 Report Posted October 23, 2012 (edited) Hi, I was trying to understand the configuration in mios32_spi.c and I am wondering if I don't understand it right or there is a small mistake... From line 76 to 79 there is the initalization of the IO-Pins: // Push-Pull Config #define MIOS32_SPI0_PP_INIT { LPC_PINCON->PINMODE_OD1 &= ~((1 << 24) | (1 << 23) | (1 << 22) | (1 << 21) | (1 << 20)); } // Open-Drain Config -- NOTE: unfortunately it has no effect on SCLK and MOSI pin! This isn't documented in the LPC17xx user manual #define MIOS32_SPI0_OD_INIT { LPC_PINCON->PINMODE_OD1 |= ((1 << 24) | (1 << 23) | (1 << 22) | (1 << 21) | (1 << 20)); } The macro MIOS32_SPI0_PP_INIT calls PINMODE_OD1 to set the resistor configuration but instead it clears the open drain mode and the next macro sets them again. Or why is the headline Push-Pull Config? Can somebody help? Best, braintu EDIT: Sorry for bothering. I understood the push/pull comment wrong. It refers to the output which push/pull-s not to the resistors... Edited October 23, 2012 by Braintu
TK. Posted October 23, 2012 Report Posted October 23, 2012 PINMODE_OD1 isn't a function, but a configuration register of the LPC17 port peripheral. MIOS32_SPI0_PP_INIT applies an AND mask over this register, which means that bits will be cleared (-> OD function for given pins disabled) MIOS32_SPI0_OD_INIT applies an OR mask over this register, which means that bits will be set (-> OD function for given pins enabled) Best Regards, Thorsten.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now