cancel
Showing results for 
Search instead for 
Did you mean: 

Moving code from G030 to C011

stevecimo
Associate II

Hi All

I have a breakout board, I've been testing some ws2812 code , I'm using  TIM1 with DMA + PWM

I developed the code on the G030, it's a 32 pin package.

I'm using internal clock and have it running at 48MHz for Timers.

Works has intended. 

 

Switch to C011 in an 8 Pin package.

Created new project in MX and just copied over the code I added.

I'm using internal clock and have it running at 48MHz for Timers.

Code does not work.  complies fine, but the leds not work.

 

In both porjects I am using TIM1 , configured the same way.

 

I don't have a Scope where I can view the PWM output

Question:  Does anyone of a any differences between how TIM1 works between both MCU? I looked through  AN5969   Migrating between STM32G0 and STM32C0 MCUs  and nothing jumped out.

Can I use CudeMonitor to review the PWM?

 

Any suggestions would be highly appreciated.

 

Regards, Stephen 

 

 

 

20 REPLIES 20

Just checked my order, parts order where STM32C011J6M6  

 

I might try a different timer.

stevecimo
Associate II

I added a simple led  toggle on a gpio pin and it never toggles

while (1)

{

int z = 9;

while (z >= 0) {

Set_Display(z, "orange");

WS2812_send();

HAL_Delay(1000);

--z;

}

HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);

z=0;

while (z <= 9) {

Set_Di

splay(z, "green");

WS2812_send();

HAL_Delay(1000);

++z;

}

z=9;

/* USER CODE END WHILE */

 

/* USER CODE BEGIN 3 */

}

 

I'll keep looking :)

 

Dear stevecimo,

I guess there is lack of basically thing.
You should not think easily migration from STM32G0.
Build a project as “STM32C0" from scratch.

Also don't forget to read the datasheet/reference-manual/errata-sheet carefully.

Best regards,
Nemui.

What you have shown looks okay.

Can you set that pin statically to 0 and 1 and measure the output level, i.e. a classic blinky? Could it be a soldering issue?

hth

KnarfB

I'll give it a try, I have received some samples MCU, Including G , F, H series in different packages....

including a Nuceo-F103RB

But I did build the project from scratch, started a new project , selected the MCU, configured the timer and clock using cubeMX , then just copied my code across.....

 

This is what ST recommend when moving between MCU?

I just used the same process to move the code to a Nucleo F103RB and is working....

 

I think I'm going to move to 20pin package and have some G and F in 20pins .

 

:)

 

Dear stevecimo,

Here is my simplest STM32C0 project("moving from" G0 project below).
https://nemuisan.blog.bai.ne.jp/?eid=192848#STM32C0

STM32G0 is here.
https://nemuisan.blog.bai.ne.jp/?eid=192848#STM32G0


Those project includes timer setting(for uSec wait timer).
And NO-CUBEIDE/NO-CUBEMX to avoid buggy code generation.

I do not have intend to answer anymore,but may be I told the just answer :)

Best regards,
Nemui.

Thanks, I'll take a look :)

stevecimo
Associate II

I have yet to figure this out, I've received some 20 pin G030 and my code works fine on them, so I'll stick with the G030 for now . :)

I also purchased a F103 Nucleo board and a C011 Discovery board and a Chinese Bluepill (F103 I think it's using a real STm32)  .

My code moves to the F103 fine (both boards) , still does not work on the C011 Discovery.......

When I get an Oscilloscope  , I'll take another look :)

 

Thanks for help :)

 

 

judelee
Visitor

Hi there,

Nice work getting it running on the G030! If the code compiles fine on the C011 but the WS2812 LEDs don’t light up, it could be a subtle difference in peripheral mapping or timer output capabilities—especially since TIM1 channels might not be routed to the same pins or even available in the 8-pin C011.

Double-check the alternate function mapping in the datasheet—TIM1_CHx may not be available on the same pins. Also, ensure DMA and NVIC settings are correctly transferred.

CubeMonitor won’t show you PWM waveforms, but it can help confirm if the timer and DMA are being triggered. For real signal checks though, a scope or logic analyzer is best.

(And side note—kind of like how people dive into tools like WhatsApp GB download for extra control, embedded dev often means digging into the fine details!)