Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Able to use Debug, but can't upload file to board using Run

Hi all,

I’ve had a lot of success so far after installing System Workbench for simple blinking light programs and such.
I’m currently having trouble getting the program to upload to the board (Nucleo F042). Everything appears to work normally, the LED on the ST Link blinks red/green, but after a few seconds the console shows ** Programming Failed **. It gives the errors:

“error waiting for target flash write algorithm”
“error writing to flash at address 0x08000000 at offset 0x00000000”

but debugging the same exact program using the ‘Debug’ option will work fine and I can view all the registers and variables and step through the program. I can upload this same program to the board using the ST Link Utiltity and everything will work fine. I also checked the board with my oscilloscope and the program is functioning properly (PWM an LED based on ADC value)

Any ideas why I can’t upload to the board from within Workbench?

Thanks in advance

If it makes any difference, this all began when I started working with the ADC Peripherals. In fact, if I comment out the ADC initialization function I created, the program will upload without a problem using Workbench.


Here’s the ADC init function in case it will help any, but I took it almost straight out of ST’s peripheral example:

void InitADC1(void)
{

ADC_InitTypeDef ADC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;

ADC_DeInit(ADC1);

// Enable Clock to ADC
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);

// GPIOA Peripheral Clock Enable
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

// Set ADC Clock Speed: Must be < 14 MHz
ADC_ClockModeConfig(ADC1, ADC_ClockMode_AsynClk);

// Configure ADC Channel 4 as Analog Input
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);

// Initialize ADC
ADC_StructInit(&ADC_InitStructure);

ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b;
ADC_InitStructure.ADC_ContinuousConvMode = DISABLE;
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_ExternalTrigConv = 0x00;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_Init(ADC1, &ADC_InitStructure);

// Conversion Channel 1 with 239.5 Cycle sampling time
ADC_ChannelConfig(ADC1, ADC_Channel_4, ADC_SampleTime_239_5Cycles);

// ADC Calibration
ADC_GetCalibrationFactor(ADC1);

// Enable ADC Peripheral
ADC_Cmd(ADC1, ENABLE);

// Wait for ADRDY Flag
while(!ADC_GetFlagStatus(ADC1, ADC_FLAG_ADRDY));

// ADC1 Software Start Conversion
ADC_StartOfConversion(ADC1);

}

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs