Skip to content

Questions on porting over to STM32G0B1RE #87

@Eqqm4n

Description

@Eqqm4n

Hello-
Firstly, apologies if this shouldn't be here. I seem to have some false memories of GIT where projects had a "question" or "discussion" section where you could discuss things without implying that something is a bug in the project.

I have some questions after following the guidelines and making a new project under Version: 1.18.1 of STM32CubeIDE. The processor being used is the G0B1 on the Nucleo-64 development board. There were the usual hiccups with the names of objects being generated by Cube not matching what is listed in the documentation, but aside from that there were two other questionable areas:

The CANopenNodeSTM32 structure has member baudrate which is set to 125 in the sample code. When I examined the project under the \stm32g0xx_fdcan folder in Cube, it reported "Nominal Baud Rate" of 125000 and 1333333 for the two CAN channels configured. So is '125' a typo in the sample code, and it should have been '125000', or does that structure member have units and if I have the 1333333 rate showing in Cube, I should assign 1333 to that member?

Secondly, the timerHandle member says "Pass in the timer that is going to be used for generating 1ms interrupt for tmrThread function". So I assume if I am using TIM6, for example, I assign it to this member. This was curious because the default value there is TIM17, but that interrupt is shared with the CAN interrupts in the example project. Be that as it may, the question comes up in this function:

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* USER CODE BEGIN Callback 0 */

  /* USER CODE END Callback 0 */
  if (htim->Instance == TIM1) {
    HAL_IncTick();
  }
  /* USER CODE BEGIN Callback 1 */
  // Handle CANOpen app interrupts
  if (htim == canopenNodeSTM32->timerHandle) {
      canopen_app_interrupt();
  }
  /* USER CODE END Callback 1 */
}

The directions don't specify, but it seems like TIM1 in the above code should be replaced with the 1ms interrupt timer, correct (TIM6, in my case)? And there's also a problem since HAL_IncTick(); is also being invoked by the SysTick timer which cube has set up running behind the scenes. This would then need to be disabled, correct? Or does Cube need to be told to set the TimeBase source to use the 1ms timer instead of SysTick?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions