Ingenic Zeratul T31 System Resources and GPIO Configuration 20201017 EN

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Machine Translated by Google

Ingenic®

system resources and GPIO configuration

Date: Sep.2020
Machine Translated by Google

Junzheng®

System resources and GPIO configuration

Copyright © Ingenic Semiconductor Co. Ltd 2019. All rights reserved.

Release history

Date Revision Change


Sep.2020 1.0 First release
Oct.2020 1.1 Second release

Disclaimer

This documentation is provided for use with Ingenic products. No license to


Ingenic property rights is granted. Ingenic assumes no liability, provides no warranty
either expressed or implied relating to the usage, or intellectual property right
infringement except as provided for by Ingenic Terms and Conditions of Sale.

Ingenic products are not designed for and should not be used in any medical or
life sustaining or supporting equipment.

All information in this document should be treated as preliminary. Ingenic may


make changes to this document without notice. Anyone relying on this
documentation should contact Ingenic for the current documentation and errata.

Beijing Junzheng Integrated Circuit Co., Ltd.

Address: Junzheng Building, Building 14, Yard East District, No. 10 Xibeiwang East Road, Haidian District, Beijing

Tel: (86-10)56345000
Fax: (86-10)56345001
Http: //www.ingenic.c
Machine Translated by Google

T31 system resources and GPIO configuration

1 Board level file configuration

The following takes the configuration of T31 board-level files as an example. The main directory is under os/kernel/arch/mips/xburst/soc-t31.

Most of the definitions and uses of GPIO mainly use the following three files:

1.1 Board-level file description

(1) platform.h mainly

configures GPIO hardware resource functions, and the macros named in it will be used in platform.c. Take uart as

Examples illustrate the meaning of macro definitions: For example, define PB23 and PB24 of UART1

.name: the defined name.port: the

group it belongs to, PA is GPIO_PORT_A, and so on. func: GPIO function definition,

it should be defined according to the GPIO manual. pins: PB23 and PB24 of UART1 are defined.

Implemented through bit operations, setting a certain bit corresponds to a pin

(2) board.h mainly

configures custom GPIO resources, such as simulating I2C, etc.

T31 system resources and GPIO configuration 1


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

(3) platform.c selects


the macro definition of platform.h according to the configuration of config.

T31 system resources and GPIO configuration 2

Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.


Machine Translated by Google

T31 system resources and GPIO configuration

1.2 GPIO adjustment method

When adjusting GPIO usage, it is recommended to turn on the system debug mode. For the specific opening method,

please check the document "Zeratul_T31_SDK Instructions for Use" - Common

Debugging Chapter of T31 System. Then open the two files platform.h and board.h under soc-t31. Found conflicting GPIO definition
Position, comment it out or set it to -1. For example

For specific GPIO adjustment methods, please check the following documents:

"Zeratul_Development_Manual"--Common handling methods for GPIO conflicts

2 GPIO Query Setting Tool

In order to facilitate users to test GPIO status, GPIO tools are provided. Currently, the tool supports querying GPIO status

and setting GPIO functions. Path

"tools/debug/gpiotool". Please see READM for specific usage.

T31 system resources and GPIO configuration 3

Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.


Machine Translated by Google

T31 system resources and GPIO configuration

3 UART usage

The main UART pin selections are as follows, the same group cannot be reused, for example, uart1 enables PA7
PA6 can no longer enable the UART function of PB23 and PB24.

UART0: PB19(RXD), PB20(CTS), PB21(RTS), PB22(TXD); PC8(TXD),


PC9(RXD);PC15(CTS), PC16(RTS)
UART1: PA6(TXD), PA7(RXD); PB23(TXD), PB24(RXD)
UART2: PA10(TXD), PA11(RXD); PC11(CTS), PC12(RTS), PC13(TXD),
PC14(RXD)

Use make menuconfig to configure UART; exit after save

T31 system resources and GPIO configuration 4


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

3.1 Test UART


Test code location: userland/base_code Test conditions: baud

rate 115200; stop bit 1; data bit 8; no parity. Open minicom/serial port assistant and connect the

device. Run the program as shown below, minicom/serial port assistant

The hand receives the data. Then input characters through minicom/serial port assistant, and the board receives the data.

T31 system resources and GPIO configuration 5


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

T31 has two sets of hardware I2C,


4 I2C use
as follows SMB0:PA12(smb0_sda), PA13(smb0_sck)
SMB1:PA16(smb1_sda), PA17(smb1_sck); PB25(smb1_sda), PB26(smb1_sck)
SMB0 is generally a fixed connection to the Sensor. SMB1 can be configured and used as needed. The above are both SMB1. The two groups

cannot be used at the same time!

4.1 Configuration steps

Enter "os/kernel" and enter the command make menuconfig. Find the following configuration

T31 system resources and GPIO configuration 6

Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.


Machine Translated by Google

T31 system resources and GPIO configuration

4.2 Test I2C


Test code location: userland/base_code Take 24c02 as an example for

reading and writing tests:

Use the logic analyzer again to capture the waveform as follows:

T31 system resources and GPIO configuration 7

Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.


Machine Translated by Google

T31 system resources and GPIO configuration

5 SPI usage

5.1 Configuration steps

Open make menuconfig configuration to find SPI

As shown in the figure above, SPI1 is selected as an example. The ones used here are PB17 PB18 PB25 PB26. Configuration completed

After burning the newly compiled kernel. The device node /dev/spidev1.0 will appear. Test

code location: userland/base_code

T31 system resources and GPIO configuration 8


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

According to the SPI test code, compile and run, send the data and use the logic analyzer to capture the picture as shown below, then the test is successful.

5.2 SPI without device node situation

Because the default SPI1 is used to communicate with 7682, if you do not use 7682 wifi, you can modify the kernel code to use

Use SPI1. The specific steps are as follows, and then re -make menuconfig configuration

Step 1. Add spidev

Step 2. Declare the creation content

Step 3. Define the device

T31 system resources and GPIO configuration 9


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

Step 4. Board-level initialization to create devices

T31 system resources and GPIO configuration 10


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

6 PWM usage

T31 has a total of four PWM channels: pwm0, pwm1, pwm2, and pwm3. GPIO configurable PWM function pin:

PA14(pwm0);PA22(pwm1);PB17(pwm0);PB18(pwm1);PB27(pwm2);PB28(pwm3)

5.1 Usage steps


Execute the make menuconfig command in the kernel source code root directory to enter the configuration interface. Do not use the kernel auto-

With the driver, you only need to configure the following options.

Device Drivers --->


[*] Pulse-Width Modulation (PWM) Support --->
[] JZ PWM driver (NEW)
*** JZ PWM function pin select ***

5.1.1 Driver reference

Test code location: userland/base_code reference code

sample_pwm. For specific usage methods, please view the README in the sample_pwm directory.

The driver version applicable to this chapter is "H20180309a"

Note: The TCU module will be used when using related PWM; if the product uses a motor at the same time, please confirm

whether it conflicts with the TCU in the motor drive! The set polarity represents the polarity of the effective level, and duty represents the

duty of the effective level. For example: polarity =0, duty=0: means that the low level is the effective level, and the duty of the effective

level is 0. The customer

reference code is test_pwm.c; the unit of the setting period is nanoseconds!

T31 system resources and GPIO configuration 11


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.
Machine Translated by Google

T31 system resources and GPIO configuration

7 ADC

6.1 Usage steps

Kernel configuration, execute the make menuconfig command in the kernel source root directory to enter the configuration

interface, configure as follows

Device Drivers --->


Multifunction device drivers --->
<*> Support for the XBurst SADC core
<*> Support for the XBurst SADC AUX

6.1.1 Application routine reference

Test code location: imp-t31/samples/libsysutils-samples The reference code is in

sample-adc.c. Zeatul T31 uses the ADC reference voltage of 3.3V by default. Note: ADC_PATH in the reference code indicates

which ADC to select; STD_VAL_VOLATAGE indicates the reference voltage in mv!

T31 system resources and GPIO configuration 12


Copyright® 2005-2019 Ingenic Semiconductor Co., Ltd. All rights reserved.

You might also like