Stuck bits with Nucleo F103RB, CubeMx program.

Share code examples or discuss embedded software, including device drivers, interrupt handlers, middleware and application code.

Moderators: Markus Girdland, Mattias Norlander

bhaskins
Posts: 2
Joined: Mon Feb 05, 2018 1:41 pm

Stuck bits with Nucleo F103RB, CubeMx program.

Postby bhaskins » Thu Mar 22, 2018 9:02 pm

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

craigbailey
Posts: 2
Joined: Wed Jan 31, 2018 1:31 pm

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Postby craigbailey » Mon Apr 16, 2018 8:25 pm

Have you found the solution or not?
Hi Here I have found football betting sites uk. Thanks for sharing!

bhaskins
Posts: 2
Joined: Mon Feb 05, 2018 1:41 pm

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Postby bhaskins » Thu Apr 26, 2018 3:24 am

No, and i''ve tried it several more times.
Even worse, the board works fine under stm32duino.

edwardmartin755
Posts: 1
Joined: Sat Dec 01, 2018 12:43 am

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Postby edwardmartin755 » Sat Dec 01, 2018 12:58 am

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.

frank_ee
Posts: 65
Joined: Wed Apr 05, 2017 5:08 pm
Location: USA

Re: Stuck bits with Nucleo F103RB, CubeMx program.

Postby frank_ee » Tue Dec 04, 2018 7:03 pm

Hello,

Are those pins used on another peripheral?


Return to “Embedded target code development discussions”

Who is online

Users browsing this forum: No registered users and 0 guests