Question
Keil µVision5 - NUCLEO STM32F334R8 - Running the GPIO Toggle code
Posted on June 21, 2016 at 15:03
Hi,
still completely stuck with my waveform generation on my NUCLEO-F334R8, I thought it could be a food thing to start from the beginning, with a more simple code. So I tried GPIO Toggle example from the standard libraries. I understand that I'm supposed to observe a signal on the scope, then nothing, then signal again, etc. There is no GPIOE on F334R8, so I changed it to GPIOC. This is the only change I made.
#include ''stm32f30x.h''
/* Private define ------------------------------------------------------------*/
#define BSRR_VAL 0xC000
/* Private variables ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
int
main(
void
)
{
/* GPIOC Periph clock enable */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
/* Configure PC14 and PC15 in output pushpull mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOC, &GPIO_InitStructure);
while
(1)
{
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15*/
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC0 and PC1 */
GPIOC->BRR = BSRR_VAL;
/* Set PC14 and PC15 */
GPIOC->BSRR = BSRR_VAL;
/* Reset PC14 and PC15 */
GPIOC->BRR = BSRR_VAL;
}
} And i still have the orange LED1 that indicates the running has failed.
I think the problem is deeper than just related to the code I'm trying to execute, it might have something to do with the manner I'm trying to execute it, I don't know, but I think if I could run this code (or a blinky, which I don't have as example), I could progress.
Thank you.