2015-10-20 02:29 AM
gpioc pin 0 and gpio a pin 0 &1 work fine
but gpio c pin 1 and furhter show 0.5v at output instead of 3 volts. here is the code i implemented &sharpinclude ''main.h'' static __IO uint32_t TimingDelay; //------------------------------------------------------------------------------ // Function Name : Init _GPIO pins // Description : pins ,port clock & mode initialization. //------------------------------------------------------------------------------ void Init_GPIO(void) { /* GPIO config */ GPIO_InitTypeDef GPIO_InitDef; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); GPIO_InitDef.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3; GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitDef.GPIO_OType = GPIO_OType_PP; GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz; //Initialize pins GPIO_Init(GPIOC, &GPIO_InitDef); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); GPIO_InitDef.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3; GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitDef.GPIO_OType = GPIO_OType_PP; GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitDef.GPIO_Speed = GPIO_Speed_50MHz; //Initialize pins GPIO_Init(GPIOA, &GPIO_InitDef); //volatile int i;} } void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while(TimingDelay != 0); } /** * @brief Decrements the TimingDelay variable. * @param None * @retval None */ void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } /******************************************************************************* * Function Name : main * Description : Main program. *******************************************************************************/ int main(void) { Init_GPIO(); //calling a function while(1)//infinite loop { /*ODR bits can be individually set and reset */ //for displaying 0 GPIO_SetBits(GPIOC, GPIO_Pin_0); GPIO_SetBits(GPIOA, GPIO_Pin_0); GPIO_SetBits(GPIOC, GPIO_Pin_2); GPIO_SetBits(GPIOA, GPIO_Pin_1); } } #no-crystal-ball2015-10-21 02:05 AM
2015-10-21 03:01 AM
Ah, so this is a DISCOVERY board? You might've said that right away...
These pins are connected to the on-board resources - the user-USB-connector, the touch surface and the gyroscope. Those which go to the USB header and touch surface are not connected to the header unless the jumpers (solder bridges, SB20, SB23, SB27-SB32 - located on the bottom of PCB, as indicated in Fig.4 in UM1690) are closed (shorted with a drop of solder); you might want to remove the parallel capacitors C26-C28 and maybe also the series resistors R38-R40; and avoid using the user-USB header. I don't see a way to use those which go to the gyroscope other than to remove the chip or cut the traces. I don't have the board, just working out of the UM1690. And you've said PC0 works just fine. JW2015-10-22 03:16 AM