Page 1 of 1

Problem creating new Variant STM32L151C

Posted: Wed Sep 30, 2020 9:03 pm
by toogooda
Hi I created two new Variants using the github wiki instructions here https://github.com/stm32duino/wiki/wiki ... nt-(board) one works perfectly the other compilies but does not work with blink example.
I can rule out hardware as blink using stm32cudeprogramer works fine.

Here is the boards.txt

Code: Select all

################################################################################
# Generic L1
GenL1.name=Generic STM32L1 series

GenL1.build.core=arduino
GenL1.build.board=GenL1
GenL1.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial}

# Generic L151C8xx
GenL1.menu.pnum.L151C8xx=Generic L151C8
GenL1.menu.pnum.L151C8xx.upload.maximum_size=65536
GenL1.menu.pnum.L151C8xx.upload.maximum_data_size=10240
GenL1.menu.pnum.L151C8xx.build.mcu=cortex-m3
GenL1.menu.pnum.L151C8xx.build.board=L151C8xx
GenL1.menu.pnum.L151C8xx.build.series=STM32L1xx
GenL1.menu.pnum.L151C8xx.build.product_line=STM32L151xB
GenL1.menu.pnum.L151C8xx.build.variant=Generic_L151Cx
GenL1.menu.pnum.L151C8xx.build.cmsis_lib_gcc=arm_cortexM3l_math

# Generic L151C8xxA
GenL1.menu.pnum.L151C8xxA=Generic L151C8-A
GenL1.menu.pnum.L151C8xxA.upload.maximum_size=65536
GenL1.menu.pnum.L151C8xxA.upload.maximum_data_size=32768
GenL1.menu.pnum.L151C8xxA.build.mcu=cortex-m3
GenL1.menu.pnum.L151C8xxA.build.board=L151C8xxA
GenL1.menu.pnum.L151C8xxA.build.series=STM32L1xx
GenL1.menu.pnum.L151C8xxA.build.product_line=STM32L151xBA
GenL1.menu.pnum.L151C8xxA.build.variant=Generic_L151CxA
GenL1.menu.pnum.L151C8xxA.build.cmsis_lib_gcc=arm_cortexM3l_math

# Upload menu
GenL1.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)
GenL1.menu.upload_method.swdMethod.upload.protocol=0
GenL1.menu.upload_method.swdMethod.upload.options=-g
GenL1.menu.upload_method.swdMethod.upload.tool=stm32CubeProg

GenL1.menu.upload_method.serialMethod=STM32CubeProgrammer (Serial)
GenL1.menu.upload_method.serialMethod.upload.protocol=1
GenL1.menu.upload_method.serialMethod.upload.options={serial.port.file} -s
GenL1.menu.upload_method.serialMethod.upload.tool=stm32CubeProg

GenL1.menu.upload_method.dfuMethod=STM32CubeProgrammer (DFU)
GenL1.menu.upload_method.dfuMethod.upload.protocol=2
GenL1.menu.upload_method.dfuMethod.upload.options=-g
GenL1.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg

GenL1.menu.upload_method.bmpMethod=BMP (Black Magic Probe)
GenL1.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp
GenL1.menu.upload_method.bmpMethod.upload.tool=bmp_upload

L151C8xxA is the working one L151C8xx is the one that is a problem
I used the timer config and LD file from the working stm32cubeprogrammer so not sure what to try next.

It compiles, downloads but does not blink.

Attached full variant folder

Any ideas?

Thanks

Re: Problem creating new Variant STM32L151C

Posted: Thu Oct 01, 2020 4:38 am
by fpiSTM
Probably the clock config.

Re: Problem creating new Variant STM32L151C

Posted: Thu Oct 01, 2020 8:29 pm
by toogooda
fpiSTM wrote: Thu Oct 01, 2020 4:38 am Probably the clock config.
"void SystemClock_Config(void)" function was copied from STM32CubeIDE auto generated form a working blink example that was tested.
other than that function in variant.cpp are you referring to any other config?

here it is here

Code: Select all

void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

  /** Configure the main internal regulator output voltage
  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL8;
  RCC_OscInitStruct.PLL.PLLDIV = RCC_PLL_DIV2;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)
  {
    Error_Handler();
  }
}

Re: Problem creating new Variant STM32L151C

Posted: Wed Oct 07, 2020 9:15 pm
by toogooda
fpiSTM wrote: Thu Oct 01, 2020 4:38 am Probably the clock config.
@fpiSTM are you able to give me more detail? I can't seem to solve this, I used the SystemClock_Config(void) that worked in STM32CubeIDE can you give me anything else I can check?

Thanks

Re: Problem creating new Variant STM32L151C

Posted: Wed Oct 07, 2020 10:22 pm
by .rpv
toogooda wrote: Wed Oct 07, 2020 9:15 pm
fpiSTM wrote: Thu Oct 01, 2020 4:38 am Probably the clock config.
@fpiSTM are you able to give me more detail? I can't seem to solve this, I used the SystemClock_Config(void) that worked in STM32CubeIDE can you give me anything else I can check?

Thanks
Hi, you could check if there is a pin naming error, instead of a blinking sketch you just use HIGH on the LED-pin and with a multimeter or with an external led+resistor check every pin to see if a wrong pin is getting the HIGH value.