3103 views|7 replies

7

Posts

0

Resources
The OP
 

[Fudan Micro FM33LC046N Review] + GPTIM breathing light [Copy link]

  This post was last edited by Just Call Me Ah Shen on 2021-2-25 23:37

I powered on the Jlink and tested it as soon as I got it. I don't know if it was a problem with the Jlink firmware version or the hardware itself, but the MDK upload program could not recognize the chip.

I have tried but the problem has not been solved. If anyone encounters this problem, please give me some advice.

Everything can be lit up. A blogger has already made a program to control LED with buttons. Today, let’s make a breathing light!

According to the manual, LC046N has six timers.

The LEDs of the demo board are mounted on two general timers GPTIM

Here we use LED3 as the demonstration object, LED3 corresponds to GPIO_B10

Initialize GPIO_B10 and channel 1 of GPTIM0, set the pre-scaling coefficient and auto-reload value;

void MF_GPTIM0_TimerBase_Init(void)
{

  FL_GPTIM_InitTypeDef  TimerBaseInitStruct;

  TimerBaseInitStruct.prescaler = (uint16_t)999;  //预分频系数
  TimerBaseInitStruct.counterMode = FL_GPTIM_COUNTER_DIR_UP;//计数模式
  TimerBaseInitStruct.autoReload = 120;      //自动重装载值
  TimerBaseInitStruct.autoReloadState = DISABLE;//预装载使能
  TimerBaseInitStruct.clockDivision = FL_GPTIM_CLK_DIVISION_DIV1;//采样时钟分频比

  FL_GPTIM_Init(GPTIM0,&TimerBaseInitStruct );

 
}

void MF_GPTIM0_Channel1_Init(void)
{

  FL_GPIO_InitTypeDef  GPIO_InitStruct;

  FL_GPTIM_OC_InitTypeDef  defaultInitStruct;

  GPIO_InitStruct.pin = FL_GPIO_PIN_10; //GPIO
  GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;//模式
  GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;//输出类型
  GPIO_InitStruct.pull = DISABLE; //上拉试能
  GPIO_InitStruct.remapPin = ENABLE;//重定向

  FL_GPIO_Init( GPIOB, &GPIO_InitStruct );

  defaultInitStruct.OCMode = FL_GPTIM_OC_MODE_PWM1;//输出模式
  defaultInitStruct.OCFastMode = DISABLE;
  defaultInitStruct.OCPreload = DISABLE;
  defaultInitStruct.compareValue = 0x1F4U;
  defaultInitStruct.OCPolarity = FL_GPTIM_OC_POLARITY_NORMAL;
  defaultInitStruct.OCETRFStatus = DISABLE; //ETR清零使能

  FL_GPTIM_OC_Init(GPTIM0,FL_GPTIM_CHANNEL_1,&defaultInitStruct );

 
}


You can see the output function of TIM in fm33lc0xx_fl_gptim.h and call it directly in the main function

main.c

#include "main.h"
#include "demo_gptim.h"



int main(void)
{
		uint16_t pwmval=10;	
	  uint8_t dir=1;
    MF_Clock_Init();
    

    MF_SystemClock_Config();

    UserInit();


    MF_Config_Init();
    GPTIM_Start( );
	
    while(1)
    {     DelayMs(6);
       
		if(dir)pwmval++;
		else pwmval--;

		if(pwmval>160)dir=0;
		if(pwmval<10)dir=1;										 
		
	  	//pwmval++;
     // FL_GPTIM_WriteCompareCH2(GPTIM0,pwmval);
		 FL_GPTIM_WriteCompareCH1(GPTIM0,pwmval);
    }

}


Operation effect

VID_20210225_231318.mp4

8.48 MB, downloads: 12

效果视频

This post is from Domestic Chip Exchange

Latest reply

Uncheck Reset and Run and try again   Details Published on 2021-2-28 23:49
 
 

7

Posts

0

Resources
From 7
 

The problem of Jlink failing to recognize the chip during burning has been solved

Cause: Power supply problem

Since there is no extra USB_B data cable, the board has no other external power supply except Jlink, which causes the chip to lose power and stop working during burning.

This post is from Domestic Chip Exchange
 
 
 

1412

Posts

3

Resources
2
 
Generally, if JTLINK fails to connect, it is a driver problem. There is usually no problem with the hardware.
This post is from Domestic Chip Exchange
 
 
 

174

Posts

1

Resources
3
 

Dear, it should be that you did not select the right flash. Download the jflash project configuration from this link https://m.eeworld.com.cn/bbs_thread-1155827-1-1.html, find the flash of this development board, then add the flash in the flash download in Keil, and then try to burn it.

This post is from Domestic Chip Exchange

Comments

Dear, I chose LC046. This error does not occur every time, but it always happens when burning the FreeRTOS demo, which makes it impossible to burn [attachimg]526030[/attachimg]  Details Published on 2021-2-26 13:53
 
 
 

7

Posts

0

Resources
4
 
chrisrh posted on 2021-2-26 12:18 Dear, it seems that you did not choose the right flash. In this link https://m.eeworld.com.cn/bbs_thread-1155827-1-1.html, put jflash ...

Dear, I chose LC046. This error does not occur every time, but it always happens when burning the FreeRTOS demo, which causes it to fail to burn.

This post is from Domestic Chip Exchange

Comments

Uncheck Reset and Run and try again  Details Published on 2021-2-28 23:49
 
 
 

7462

Posts

2

Resources
5
 

Very detailed, I learned a lot, thanks for sharing

This post is from Domestic Chip Exchange
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

174

Posts

1

Resources
6
 
Just call me Ah Shen. Posted on 2021-2-26 13:53 Dear, I chose LC046. This error does not occur every time, but the FreeRTOS demo is always like this and cannot be burned...

Uncheck Reset and Run and try again

This post is from Domestic Chip Exchange

Comments

The power supply problem has been solved, thank you  Details Published on 2021-3-1 12:07
 
 
 

7

Posts

0

Resources
8
 
chrisrh posted on 2021-2-28 23:49 Uncheck Reset and Run and try again

The power supply problem has been solved, thank you

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list