2151 views|7 replies

862

Posts

2

Resources
The OP
 

[RVB2601 Creative Application Development] Experience Sharing 2: Lighting in Multiple Ways, Component Learning [Copy link]

 This post was last edited by wo4fisher on 2022-3-19 22:07

Using MCU to light the lights, after layers of packaging by YOC, there is no longer only one way to light the lights.

1. Use YOC's AOS API HAL hardware abstraction layer interface to light up GPIO · GitBook (t-head.cn)

For the gpio operation implementation of different underlying drivers, they are uniformly encapsulated into the hal interface described in this article. When the upper layer uses related functions, the hal layer interface is uniformly called to ensure the universality of the app. The hal related header files are located in the directory:

链接已隐藏,如需查看请登录或者注册
The hal related implementation is located in the specific mcu directory

The driver interface is as follows: (include header file when used:)

#include "aos/hal/gpio.h"

can realize GPIO output high level, low level and inversion operations.

2. Use YOC's AOS API CSI2's GPIO_PIN device GPIO_PIN GitBook (t-head.cn)

GPIO (General-purpose input/output) is the abbreviation of general-purpose input/output. In embedded systems, it is often necessary to control many external devices or circuits with simple structures. Some of these devices need to be controlled by the CPU, and some need the CPU to provide input signals. In addition, many devices or circuits only require two states: on/off, such as the on and off of an LED. It is more complicated to control these devices using traditional serial ports or parallel ports. Therefore, a "general-purpose programmable I/O port", or GPIO, is usually provided on embedded microprocessors.

Include header files when using

#include <drv/gpio_pin.h>

can realize GPIO output high level, low level and inversion operations.

3. Using YOC's AOS API CSI2 GPIO device GPIO GitBook (t-head.cn)

GPIO (General-purpose input/output) is the abbreviation of general-purpose input/output. In embedded systems, it is often necessary to control many external devices or circuits with simple structures. Some of these devices need to be controlled by the CPU, and some need the CPU to provide input signals. In addition, many devices or circuits only require two states: on/off, such as the on and off of an LED. It is more complicated to control these devices using traditional serial ports or parallel ports. Therefore, a "general-purpose programmable I/O port", or GPIO, is usually provided on embedded microprocessors.

In fact, there is a question here. The official documentation explains the same thing about GPIO and the GPIO_PIN device mentioned above, and the operation interface looks basically the same.

Include the header file when using:

#include <drv/gpio.h>

can realize GPIO output high level, low level and inversion operations.

In addition, the AOS API's csi also has csi1, the official explanation

CSI is for embedded systems, defining unified software interface specifications for CPU core migration interfaces and peripheral device operation interfaces, eliminating differences between different chips, simplifying software usage and improving software portability. Through the CSI interface specification, chips can be quickly connected to the YoC platform.

The specific contents of CSI include:

  • CSI-CORE : defines the interface specification between the CPU and related tightly coupled peripherals
  • CSI-DRIVER : defines the interface specifications of commonly used drivers
  • CSI-KERNEL : Defines the interface specification for real-time operating systems

Note: The CSI2 driver interface has a significant improvement in code density compared to CSI1

4. Using YOC's AOS API PWM Device PWM GitBook (t-head.cn)

Pulse width modulation (PWM) is a powerful digital encoding technology for analog signals. It uses a high-resolution counter to generate a square wave and encodes the analog signal by modulating the duty cycle of the square wave.

Include the header file when using:

#include <drv/pwm.h>

5. Source code and usage

Create a project according to the official helloworld example, then create a new LED folder under app, and put the myled.c and myled.h files into the LED folder.

Modify the main.c file according to main.c.

Open myled.h and select the macro definition according to the type.

myled.h (316 Bytes, downloads: 1)

main.c (893 Bytes, downloads: 0)

myled.c (4.05 KB, downloads: 0)

Next: Key input

Latest reply

What is the full name of CSI?   Details Published on 2022-3-20 10:26
Personal signature水不撩不知深浅 人不拼怎知输赢
 
 

862

Posts

2

Resources
2
 

Feelings after using it:

1. Use of Yoc Cloud Document

1.1 RVB2601 is not included in the YOC documentation

1.2 There are some minor errors in the yoc cloud document, especially in the routines included in the component interface, which is not very user-friendly.

For example, in the routine of gpio api in csi2, the definition of EXAMPLE_TOGGLE_GPIO_IDX is missing, and readers need to read the code to figure it out.

1.3 After a few days of experience, I found that there are many duplicate APIs in the 1520 certified routines, and there is no good official documentation on the dependencies of various packages (I still haven't found it). For example, the driver of the chip_ch2601 package contains the .c source files of various peripherals, while in the csi package, the corresponding drv contains the corresponding .h header files, which is also very confusing.

2. CDK usage experience

2.1 After CDK is installed, the project pulled down by default has no code prompt. I installed it on two computers, one has it, but it also quits, and the other one doesn't have it most of the time.

2.2 When you right-click in the code to go to the definition, it often fails to jump.

2.3 For the header files included in the code, when you right-click to open the file, it can be opened in very few cases, and most of the time it is invalid.

2.4 cdk is too hardware-intensive. VS2019 and AD2022 have never been so stuck.

Comments

What is the full name of CSI?  Details Published on 2022-3-20 10:26
Personal signature水不撩不知深浅 人不拼怎知输赢
 
 
 

6820

Posts

11

Resources
3
 

The author, you are very attentive. I feel that you really put your heart into writing this post. I have to learn from you carefully.

My experience with CDK is really the same as yours, especially when opening the project, it took at least 10 minutes to recover.

 
 
 

149

Posts

0

Resources
4
 

How can I view the internal structure of a structure similar to csi_pwm_t? I can't click on parse all project even if I right click on it.

Comments

If you can't jump by right clicking, you can only open it layer by layer in the project directory tree on the left. Probably in the chip_2601 package, there is a corresponding h header file. In addition, there is a corresponding c file in another package, such as pwm, gpio, gpio_pin, etc.  Details Published on 2022-3-20 13:25
 
 
 

149

Posts

0

Resources
5
 
wo4fisher posted on 2022-3-19 22:27 My experience after using it: 1. Use of yoc cloud document 1.1 RVB2601 is not added to the YOC document 1.2 There are some minor errors in the yoc cloud document, ...

What is the full name of CSI?

Comments

The full name is unclear, and I haven't found the corresponding English full name. The general function is to define the MCU/SoC core and on-chip peripheral related operation API interface specifications under the RISCV architecture, function names, input parameters, return types, and then implement the API specifically for a specific chip. Of course, these interfaces have been  Details Published on 2022-3-20 13:28
 
 
 

862

Posts

2

Resources
6
 
Mengxi Kaiwu published on 2022-3-19 23:40 How can I view the internal structure of a structure similar to csi_pwm_t? I can't click on parse all project by right clicking it

If you can't jump by right clicking, you can only open it layer by layer in the project directory tree on the left. Probably in the chip_2601 package, there is a corresponding h header file. In addition, there is a corresponding c file in another package, such as pwm, gpio, gpio_pin, etc.

 
 
 

862

Posts

2

Resources
7
 
Mengxi Kaiwu published on 2022-3-20 10:26 What is the full name of CSI

The full name is unclear, and I haven't found the corresponding English full name.
The general function is to define the MCU/SoC core and on-chip peripheral related operation API interface specifications under the RISCV architecture, function names, input parameters, return types, and then implement the API specifically for specific chips.
Of course, these interfaces have been implemented in RVB2601.

 
 
 

862

Posts

2

Resources
8
 

Steps to use the three files above:
1. Create a new LED folder under app/src/, and then put the two myled files into it
. 2. In the project directory tree, open app--src, then right-click and select add source folder, and add the LED directory in the opened window.
3. Open main.c and copy the content in main.c to the main.c of the project.
4. Open the package configuration file under the project directory, add the reference of the LED directory in include and src, and include all .c files (this can refer to the existing content writing method). There may be operations with the same effect in cdk.
Then compile, download, and observe the effect.
Open myled.h and select the interface type to be used through the initial macro definition for testing.

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

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