| Author | beginning argument ( Replies received: 4 ) |
| gary.anderson |
Posted 20-11-2008 at 01:30   |

Registered on : 11-20-2009
Messages : 7
OFF-Line
|
I am quite new to the microcontroller field and ran into a problem modding the code from the GPIO IOtoggle example given to you in the um0427 download from STMicro. I am using IAR Embeded IDE and am trying to output toggled bits on the Daughter board extension connector CN10.
I am able to toggle the LED bits fine with the original code, but when i try to change ports(to Port B) and add additional pins (3, 4, 5) I am not able to toggle outputs on pins 3 and 4 (CN10.PB3.PB4). The outputs on these pins remain pulled up to 3.3Volts even when i do a GPIO_ResetBits(all_pin).
I see toggling of the bits on the pins I want (5, 6, 7, 8 and 9), however, the output voltage of the pin toggled is only 1.25V. So I do not know why I am seeing this output when toggled high and it is a problem because I need a Vh logic value of at least 2.4V for my application. Below is the some modded code, where GPIO_lo1 is defined as GPIOB. One thought is that I have not enabled the clocks for gpio3 and gpio4 but have not found anything to explicitly enable those clocks (ie. existing code for the other clocks gpio5-gpio9). Any insight on this matter would be greatly appreciated, thank you!
~G
//enable clock
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_lo1, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIO_lo1, &GPIO_InitStructure);
while (1)
{
GPIO_ResetBits(GPIO_lo1, GPIO_Pin_All);
GPIO_SetBits(GPIO_lo1, GPIO_Pin_7);
}
|
|
|
Profile
Quote
|
| gary.anderson |
Posted 20-11-2008 at 01:53   |

Registered on : 11-20-2009
Messages : 7
OFF-Line
|
I also wanted to note that I followed the "How to disconnect from function block on STM3210E-EVAL board" instructions on the users manual.
I was also unsure about the 'mode', looking at the GPIO registers port configuration, seems like Modex[1:0] should be 11 (for 50MHz) and CNFx[1:0] should be 00. So i am a little confused on the format of GPIO_Mode_Out_PP being defined as Hex 0x10
|
|
|
Profile
Quote
|
| gary.anderson |
Posted 20-11-2008 at 02:23   |

Registered on : 11-20-2009
Messages : 7
OFF-Line
|
Also wanted to note that the voltage is actually around 1.9V, but is still a problem
|
|
|
Profile
Quote
|
| jilisegiar |
Posted 20-11-2008 at 11:51   |

Registered on : 01-18-2009
Messages : 74
OFF-Line
|
If you refer to the STM32103xx datasheet you will see that these pin (PB3 and PB4) are linked to JDTIO and JNTRST pins of the JTAG (main function after reset). So to use these pins as standard GPIOs, you need to disable the SWJ-DP.
The "JTAG_Remap" example of the um0427 firmware library shows how to use the JTAG IOs as standard GPIOs and gives a configuration sequence
|
|
|
Profile
Quote
|
| jj.sprague |
Posted 20-11-2008 at 19:30   |

Registered on : 02-28-2009
Messages : 205
OFF-Line
|
Agree w/jilisegiar (again) and offer this guidance:
If you have a newer "JLink" you can configure it into SWD (Serial Wire Debug) mode and thus "completely free" PB3 & PB4. You should be able to do this completely w/in IAR - follow JTag Remap example as suggested to insure that the pins are available for your use.
|
|
|
Profile
Quote
|