2021-07-22 10:07 AM
Hello! I'm working on a custom STM32WB board (schematic attached -- I jumped VDDRF to 3.3V)
I'm trying to create a basic project and pull PA5 (My LED pin) high to verify programs run.
I'm using CUBE IDE and set pin PA5 to GPIO_Output with output level as high. Here is my GPIO_Init:
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
/*Configure GPIO pin : PA5 */
GPIO_InitStruct.Pin = GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
Then within the main loop I'm just continuously calling
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
I'm using the MSI as my clock source and set it to 4MHz.
All configurations are defaulted by CubeIDE for the STM32WB10CC (I'm using STM32WB10CC5).
Here is my linker:
/*
******************************************************************************
**
** File : LinkerScript.ld
**
** Author : STM32CubeIDE
**
** Abstract : Linker script for STM32WB10xC Device
** 320Kbytes FLASH
** 48Kbytes RAM
**
** Set heap size, stack size and stack location according
** to application requirements.
**
** Set memory bank area and size if external memory is used.
**
** Target : STMicroelectronics STM32
**
** Distribution: The file is distributed as is without any warranty
** of any kind.
**
*****************************************************************************
** @attention
**
** <h2><center>© Copyright (c) 2021 STMicroelectronics.
** All rights reserved.</center></h2>
**
** This software component is licensed by ST under BSD 3-Clause license,
** the "License"; You may not use this file except in compliance with the
** License. You may obtain a copy of the License at:
** opensource.org/licenses/BSD-3-Clause
**
*****************************************************************************
*/
/* Entry Point */
ENTRY(Reset_Handler)
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM1) + LENGTH(RAM1); /* end of RAM1 */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x200 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 110K
RAM1 (xrw) : ORIGIN = 0x20000004, LENGTH = 0x2FFC
RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
}
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data goes into FLASH */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*(.RamFunc) /* .RamFunc sections */
*(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM1 AT> FLASH
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM1
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} >RAM1
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED
MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED
MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED
}
I have a ST Link V2 and I've stepped through the program using the debugger. Checked to see if the PC is being incremented (it is), and can't think of anything else to test at this point... Is there a way to check and see if the core is actually running the program other than stepping through it? I figured setting a GPIO high would be a basic step..
Here is the output when I upload the program:
STMicroelectronics ST-LINK GDB server. Version 5.9.1
Copyright (c) 2021, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled
Waiting for debugger connection...
Debugger connected
-------------------------------------------------------------------
STM32CubeProgrammer v2.8.0
-------------------------------------------------------------------
ST-LINK SN : 51FF6D066684565254312587
ST-LINK FW : V2J38S7
Board : --
Voltage : 3.27V
SWD freq : 240 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x494
Revision ID : Rev B
Device name : STM32WB1xxx
Flash size : 320 KBytes
Device type : MCU
Device CPU : Cortex-M4
BL Version : 0x__
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a04936.srec
File : ST-LINK_GDB_server_a04936.srec
Size : 7364 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 3]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:01.256
Verifying ...
Download verified successfully
Debugger connection lost.
Shutting down...
Am I missing a step in the configuration or initialization of GPIO? I even enabled my 32MHz HSE and checked using an oscilloscope to verify that was working.. and... it was..
I'm at a loss.
2021-07-22 10:12 AM
I can't see anything wrong with the code or schematic. I didn't check the SMPS stuff.
Can you debug and step through the code to verify it's actually getting to the main loop?
Can you verify the LEDs are soldered with the correct polarity. Should be able to use diode drop mode on a multimeter to confirm.
2021-07-22 10:15 AM
Yes, I stepped through the code to get to the main loop and it made it. I also checked to make sure LEDs are soldered correctly and used my oscilloscope to verify the pin wasn't outputting anything.
Also verified they were soldered in correct position by using a 3.3V voltage reference and manually pressed it against the side of the LEDs going to PA5. The board is correct. I even reflowed the chip to make sure the pad was touching PA5. Also.. tried driving another pin I can access high and that didnt work either.
2021-07-22 10:16 AM
Yes, I stepped through the code to get to the main loop and it made it. I also checked to make sure LEDs are soldered correctly and used my oscilloscope to verify the pin wasn't outputting anything.
Also verified they were soldered in correct position by using a 3.3V voltage reference and manually pressed it against the side of the LEDs going to PA5. The board is correct. I even reflowed the chip to make sure the pad was touching PA5. Also.. tried driving another pin I can access high and that didnt work either.
2021-07-22 10:23 AM
If the GPIO registers say it should be output high, but it's not, and you've verified connectivity, I'm out of ideas, aside from a hardware failure.
I don't know of anything special about PA5 but maybe there's a WB-specific thing I don't know about.
2021-07-22 10:29 AM
How do I check the GPIO register? In debugger mode going through in CubeIDE I can see it changing the values, but I'm not sure if it's actually set. Is there a tool where I can verify the register is set?
2021-07-22 10:30 AM
2021-07-22 10:35 AM
What register would I be looking for? And what do I do if the register isn't being set? I wont be able to test this for a few hours. I want to have a solid game plan when I get to it later.
2021-07-22 10:46 AM
2021-07-22 10:48 AM