1690 views|6 replies

149

Posts

0

Resources
The OP
 

[Rawpixel RVB2601 development board trial experience] GRB breathing light [Copy link]

  This post was last edited by Mengxi Kaiwu on 2022-3-23 13:54

Download the Jianchi CDK software in advance, and you can experience the Pingtouge RVB2601 development board. There is an RGB light on the RVB2601 development board, as shown in Figure 1-1. Search for ch2601_marquee_demo in the HOME on the far right of the CDK main interface and download it (the specific interface is shown in Figure 1-2). After opening the project, you will find that the project actually contains "two small projects": "#define CONFIG_PWM_MODE" and "#define CONFIG_GPIO_MODE". "#define CONFIG_PWM_MODE" uses PWM to implement the RGB three-color flashing mode, while #define CONFIG_GPIO_MODE uses GPIO to implement the RGB three-color flashing mode. To implement a mode, comment the other mode. For example, to implement the PWM mode, comment the GPIO mode: //#define CONFIG_GPIO_MODE. It was a bit difficult to read the program at first.

Because I didn't know how to view the program, I later learned from other posts that I should right-click the project and select Parse all project, so that I can view the specific function content, but I still can't view the content of some specific structures. I can only query from the online YOC document: https://yoc.docs.t-head.cn/yocbook/Chapter3-AliOS/CSI%E8%AE%BE%E5%A4%87%E9%A9%B1%E5%8A%A8%E6%8E%A5%E5%8F%A3/CSI2/PWM.html#csipwmt. This time I want to experience the feeling of breathing light.

Figure 1-1

Figure 1-2

Then, to implement the breathing light program, you have to modify this routine yourself. First, comment the GPIO mode: //#define CONFIG_GPIO_MODE. There are two main modified functions, namely void led_pinmux_init() and void led_refresh(). Among them, void led_pinmux_init() is the initialization program of the RGB driver, which mainly selects the GPIO port, sets the frequency, channel, effective pulse width and effective pulse level of the PWM wave; void led_refresh() is the non-linear dimming program of the RGB breathing light, csi_pwm_out_stop(&r, pwm_IO / 2) is to turn on PWM, and pwm_IO is the corresponding specific channel. Here I feel that the YOC document’s annotation on the csi_pwm_out_config function is wrong. Pulse_width_us should be: effective level time = period_us-pulse_width_us (unit us). The specific contents of the two modified functions are as follows:

void led_pinmux_init()
{
	//7是红色,2是绿色,1是蓝色
	//csi_error_t csi_pwm_out_config(csi_pwm_t *pwm,uint32_t channel,
	//uint32_t period_us,uint32_t pulse_width_us,csi_pwm_polarity_t polarity)
	//pwm: 设备句柄。
	//channel:通道号(范围0~5)。
    //period_us:信号周期时间(单位us)。
	//pulse_width_us:有效电平时间=period_us-pulse_width_us(单位us)。
    //polarity:有效电平极性。
    csi_pwm_out_config(&r, 7 / 2, 300, 100, PWM_POLARITY_HIGH);
    csi_error_t ret;
    csi_pin_set_mux(PA7, PA7_PWM_CH7);
    csi_pin_set_mux(PA25, PA25_PWM_CH2);
    csi_pin_set_mux(PA4, PA4_PWM_CH4);
	csi_pwm_init(&r, 0);
}
void led_refresh()
{
    if (g_ctr == 0)
	{
		while(g_ctr<300)

		{
	        csi_pwm_out_config(&r, 4/ 2, 600-g_ctr, g_ctr++, PWM_POLARITY_HIGH);
		    csi_pwm_out_stop(&r, 7 / 2);
		    csi_pwm_out_stop(&r, 2 / 2);
		    csi_pwm_out_start(&r, 4 / 2);
			udelay(1000 * 5);
		}
	}
    csi_pwm_out_stop(&r, 4 / 2);
	udelay(1000 * 200);	
	
	if (g_ctr==300)
	{
		while(g_ctr>0)
		{
		    csi_pwm_out_config(&r, 4 / 2, 600-g_ctr, g_ctr--, PWM_POLARITY_HIGH);
			csi_pwm_out_stop(&r, 7 / 2);
			csi_pwm_out_stop(&r, 2 / 2);
			csi_pwm_out_start(&r, 4 / 2);
			udelay(1000 * 5);
		}
			
	}
}

The demonstration results of the breathing light are as follows:


Latest reply

nmg
Basically, after publishing here, we will synchronize a copy to the Pingtouge community. >> Click here to see how to synchronize If you have any questions, please contact me. This is not a review but a DIY activity. The final work can be included in the awards.   Details Published on 2022-3-24 09:54
 
 

15

Posts

0

Resources
2
 

What a detailed article. I quickly glanced over it and then read it carefully.

 
 
 

6841

Posts

11

Resources
3
 
I would like to ask how you post on Pingtou Ge. I have never succeeded in doing so.

Comments

Are you talking about the Pingtou Ge RISC-V RVB2601 activity area?  Details Published on 2022-3-23 22:08
 
 
 

149

Posts

0

Resources
4
 
lugl4313820 posted on 2022-3-23 16:53 I would like to ask how you post on Pingtouge. I have never succeeded.

Are you talking about the Pingtou Ge RISC-V RVB2601 activity area?

Comments

Yes, I don’t know how to hand in the homework. I feel like this review is going to explode and be returned.  Details Published on 2022-3-23 22:10
 
 
 

6841

Posts

11

Resources
5
 
Mengxi Kaiwu published on 2022-3-23 22:08 Are you talking about the Pingtou Ge RISC-V RVB2601 activity area?

Yes, I don’t know how to hand in the homework. I feel like this review is going to explode and be returned.

Comments

nmg
The final assignment is to write a general project technical report  Details Published on 2022-3-24 09:54
The final assignment is to write a general project technical report  Details Published on 2022-3-24 08:45
 
 
 

149

Posts

0

Resources
6
 
This post was last edited by Mengxi Kaiwu on 2022-3-24 08:47
lugl4313820 posted on 2022-3-23 22:10 Yes, I don’t know how to hand in the homework. I feel like this review is going to blow up and be returned.

The final assignment is to write a general project technical report

 
 
 

5220

Posts

239

Resources
7
 
lugl4313820 posted on 2022-3-23 22:10 Yes, I don’t know how to hand in the homework. I feel like this review is going to blow up and be returned.

Basically, after publishing here, we will synchronize a copy to the Pingtouge community. >> Click here to see how to synchronize

If you have any questions, please contact me. This is not a review but a DIY activity. The final work can be included in the awards.

Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

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