2010-07-03 12:51 AM
Do I have to remap I2C1 when the FSMC was used?
#afio-i2c1-fsmc2011-05-17 04:57 AM
Looking at the code in GPIO_PinRemapConfig() (stm32f10x_gpio.c file) you see
if((GPIO_Remap & 0x80000000) == 0x80000000) { AFIO->MAPR2 = tmpreg; } else { AFIO->MAPR = tmpreg; } Looking in stm32f10x_gpio.h you see a bunch of remap definitions for the GPIO_Remap argument but only these ones have the MSB set. #define GPIO_Remap_TIM15 ((uint32_t)0x80000001) /*!< TIM15 Alternate Function mapping (only for Value line devices) */ #define GPIO_Remap_TIM16 ((uint32_t)0x80000002) /*!< TIM16 Alternate Function mapping (only for Value line devices) */ #define GPIO_Remap_TIM17 ((uint32_t)0x80000004) /*!< TIM17 Alternate Function mapping (only for Value line devices) */ #define GPIO_Remap_CEC ((uint32_t)0x80000008) /*!< CEC Alternate Function mapping (only for Value line devices) */ #define GPIO_Remap_TIM1_DMA ((uint32_t)0x80000010) /*!< TIM1 DMA requests mapping (only for Value line devices) */ #define GPIO_Remap_TIM9 ((uint32_t)0x80000020) /*!< TIM9 Alternate Function mapping (only for XL-density devices) */ #define GPIO_Remap_TIM10 ((uint32_t)0x80000040) /*!< TIM10 Alternate Function mapping (only for XL-density devices) */ #define GPIO_Remap_TIM11 ((uint32_t)0x80000080) /*!< TIM11 Alternate Function mapping (only for XL-density devices) */ #define GPIO_Remap_TIM13 ((uint32_t)0x80000100) /*!< TIM13 Alternate Function mapping (only for XL-density devices) */ #define GPIO_Remap_TIM14 ((uint32_t)0x80000200) /*!< TIM14 Alternate Function mapping (only for XL-density devices) */ #define GPIO_Remap_FSMC_NADV ((uint32_t)0x80000400) /*!< FSMC_NADV Alternate Function mapping (only for XL-density devices) */ This suggests that only the Value Line and XL families have the AFIO_MAPR2 register. Also the NAVD remap definition has the comment ''only for XL-density devices''.2011-05-17 04:57 AM
So it looks like a cockup in earlier devices that has been fixed with this new register in XL devices.....
Chris.2011-05-17 04:57 AM
The technical term for ''cockup'' is ''undocumented feature'' :) That applies to both hardware and firmware.
2011-05-17 04:57 AM
So I have to remap the I2C1, or using the software simulated I2C1, to avoid this pin-conflict problem on the 103ZE.