Page 1 of 1

Stuck bits with Nucleo F103RB, CubeMx program.

Posted: Thu Mar 22, 2018 9:02 pm
by bhaskins
Stuck bits with Nucleo F103RB, CubeMx program.
I've been fighting this one for some time.
This is just a simple program for using a Nano style TFT display with a Nucleo F103RB board.
Tte bit toggling works fine righr after importing from CubeMX but after adding more code bits B3 and B5 are stuck at a logic low.
The following code will show the problem:
////////////////////////////////////////////////////////////////////
static void MX_GPIO_Init(void)
{

GPIO_InitTypeDef GPIO_InitStruct;

/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, RST_Pin|D1_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, RD_Pin|WR_Pin|RS_Pin|LD2_Pin
|D7_Pin|D0_Pin|D2_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, CS_Pin|D6_Pin|D3_Pin|D5_Pin
|D4_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : RST_Pin D1_Pin */
GPIO_InitStruct.Pin = RST_Pin|D1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

/*Configure GPIO pins : RD_Pin WR_Pin RS_Pin D7_Pin
D0_Pin D2_Pin */
GPIO_InitStruct.Pin = RD_Pin|WR_Pin|RS_Pin|D7_Pin
|D0_Pin|D2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pin : LD2_Pin */
GPIO_InitStruct.Pin = LD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : CS_Pin D6_Pin D3_Pin D5_Pin
D4_Pin */
GPIO_InitStruct.Pin = CS_Pin|D6_Pin|D3_Pin|D5_Pin
|D4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);


// static void MX_GPIO_Init(void)
{

GPIO_InitTypeDef GPIO_InitStruct;

/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, RST_Pin|D1_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, RD_Pin|WR_Pin|RS_Pin|LD2_Pin
|D7_Pin|D0_Pin|D2_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, CS_Pin|D6_Pin|D3_Pin|D5_Pin
|D4_Pin, GPIO_PIN_RESET);

/*Configure GPIO pin : B1_Pin */
GPIO_InitStruct.Pin = B1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : RST_Pin D1_Pin */
GPIO_InitStruct.Pin = RST_Pin|D1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

/*Configure GPIO pins : RD_Pin WR_Pin RS_Pin D7_Pin
D0_Pin D2_Pin */
GPIO_InitStruct.Pin = RD_Pin|WR_Pin|RS_Pin|D7_Pin
|D0_Pin|D2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pin : LD2_Pin */
GPIO_InitStruct.Pin = LD2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);

/*Configure GPIO pins : CS_Pin D6_Pin D3_Pin D5_Pin
D4_Pin */
GPIO_InitStruct.Pin = CS_Pin|D6_Pin|D3_Pin|D5_Pin
|D4_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);


// TEMP TEST
while(1)
{
HAL_GPIO_TogglePin(GPIOA, D0_Pin); // toggle OK
HAL_GPIO_TogglePin(GPIOC, D1_Pin); // toggle OK
HAL_GPIO_TogglePin(GPIOA, D2_Pin); // toggle OK
HAL_GPIO_TogglePin(GPIOB, D3_Pin); // No toggle
HAL_GPIO_TogglePin(GPIOB, D4_Pin); // toggle OK
HAL_GPIO_TogglePin(GPIOB, D5_Pin); // No toggle
HAL_GPIO_TogglePin(GPIOB, D6_Pin); // toggle OK
HAL_GPIO_TogglePin(GPIOA, D7_Pin); // toggle OK
}
/* EXTI interrupt init*/
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
}
//////////////////////////////////////////
Please note that the "TEMP TEST" portion will run fine until other code is added even though that code is not called.
This problem does not show up when the same code is run on a Nucleo F401 board.

Thanks for any help,
Bert

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Posted: Mon Apr 16, 2018 8:25 pm
by craigbailey
Have you found the solution or not?

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Posted: Thu Apr 26, 2018 3:24 am
by bhaskins
No, and i''ve tried it several more times.
Even worse, the board works fine under stm32duino.

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Posted: Sat Dec 01, 2018 12:58 am
by edwardmartin755
I have also got the error with the Nucleo F103RB which is creating a huge problem So I think you must read the Ultimate Guide for Router which will help you to get to know more about it.

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Posted: Tue Dec 04, 2018 7:03 pm
by frank_ee
Hello,

Are those pins used on another peripheral?