Braintu Posted October 23, 2012 Report Share 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 Quote Link to comment Share on other sites More sharing options...
TK. Posted October 23, 2012 Report Share 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.