2023-12-05 02:16 AM - edited 2023-12-05 02:17 AM
Beginner's question here. I have Nucleo-L476RG board and trying to learn more about the code CubeMX generates. To this end I started a new project and answered 'no' to setting up the peripherals, to make it as simple as possible.
As part of MX_GPIO_Init() the B1_Pin is configured. I can't find any reason for this. The pin does not get a mention in the pinout view or the system view, and I can't find any reference to it in the generated code following its configuration.
Here is the relevant code:
__HAL_RCC_GPIOB_CLK_ENABLE();
followed by:
/*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);
Solved! Go to Solution.
2023-12-05 06:08 AM
Clicking "no" to set up peripherals will leave your chip configured in the following state, with B1 and LD2 defined:
If you want absolutely nothing configured, start with the chip itself instead of the board or un-define those pins.
2023-12-05 03:49 AM
Maybe that's the "button 1" pin which is not connected anywhere else, and starting with a Nucleo board so CubeMX knows that.
Search the source files to find the defines for B1_Pin and B1_GPIO_Port, the compare to the schematics.
2023-12-05 06:08 AM
Clicking "no" to set up peripherals will leave your chip configured in the following state, with B1 and LD2 defined:
If you want absolutely nothing configured, start with the chip itself instead of the board or un-define those pins.
2023-12-05 07:21 AM
Ok my stupidity. I confused B1 (the blue user button) with PB1. Now it’s clear. Thanks