Wireless RF Modules and dongles for IoT | Coral RF

CC1125 ModulesCC1120 ModulesCC1101 ModuleCC1201 ModulesCC1200 ModulesCC112x ModulesCC2538 Dongle USBCC2652R Dongles USBCC2652R7 Dongles USBCC2674R10 Dongle USBCC2652P7 Dongles USBCC2674P10 Dongle USBCC2652P Dongle USBZigBee DonglesCC1314 ModulesCC1311 ModulesCC1310 ModulesCC1312 ModulesCC1352 ModulesCC1354 ModulesCC13xx ModulesCC2538 ZigBee ModuleCC2652 ModulesCC2674 ModulesZigBee/BLE ModulesCC1310 Dongles USBCC1312 Dongles USBCC1311 Dongles USBCC1314 Dongles USBSUB G DonglesLR2021 ModulesSX1262 ModulesLLCC68 ModulesSX1280 ModulesLoRa Modules1 Watt Modules2 Watt Modules5 Watt ModulesHigh Power Modules1 Watt 169Mhz Modules2 Watt 169Mhz Modules5 Watt 169Mhz Modules169Mhz Modules1 Watt 433Mhz Modules2 Watt 433Mhz Modules5 Watt 433Mhz Modules433Mhz Modules1 Watt 868M Modules2 Watt 868M Modules5 Watt 868M Modules868Mhz Modules1 Watt 915M Modules2 Watt 915M Modules5 Watt 915M Modules915Mhz Modules2 Watt 1250M Module1250Mhz Modules
Product
Article

CC1310 Configuration process of GPIO peripherals

Issuing time:2022-11-16 16:50Author:Coral radio

CC1310 Configuration process of GPIO peripherals

Configuration process of GPIO peripherals


If we want to configure a pin of CC1310 chip for GPIO peripherals, we must ensure that the chip pin and the pin of GPIO peripherals index have correct correspondence.

It is mainly divided into the initialization of corresponding pins and the initialization of corresponding GPIO peripherals.


Pin initialization


First, we want to use a pin of CC1310 as a GPIO pin. We must initialize the pin. The initialization of pins can be divided into three steps as shown in the figure above.


Pin declaration


The declaration I'm talking about here is not like the variable declaration in C language, but in the routine of CC1310, the physical address of each pin is predefined, and we can use the predefined CC1310_ LAUNCHPAD. h file.


Note that this step is not necessary. It is only convenient for us to understand the program more easily when writing the program, and enhances the overall portability of the code. But if we use this pin predefined declaration method, we must ensure that our predefined name points to the physical address of the IO pin we want to use.


As shown in the figure below:

Here is another nonsense. Why add the predefined pin

If I want to use a red led light as the indicator of CC1310 working status, and choose to use IO_ As the output pin of an led lamp, I will_ The physical address of 0 is predefined as CC1310_ LAUNCHPAD_ PIN_ RLED, so that when we want to change the level of the red LED light pin when writing the application, we can directly call the predefined name, which will be more convenient for us to understand the role of the pin. If we want to use IO later_ 6 is the output pin of the red led light, so only use the IO_ 0 changed to IO_ 6, instead of modifying the application program we wrote, which increases the overall portability of the application code.


In addition, if you want to add a green led light later to indicate some other working states of CC1310, I can also predefine it here in advance, without setting the actual pin physical address, so that we can continue to expand the program functions later.


Add pin declaration

After we predefine the pin we want to use, we can use it during pin initialization.


However, before pin initialization, we must configure its corresponding attributes. This is to prepare for the pin initialization by writing the pin and the corresponding attributes into the corresponding register.


We can use CC1310_ The following code is found in the LAUNCHPAD. c file:

PIN in this code_ The Config form configures the attributes of all pins used in the program.


If we want to add some predefined pins, we need to add the pin names to be used in the modified attribute configuration table and add the pin attributes we want to implement.


In addition, this part of the code also stipulates that the hardware and software interrupts generated by these pins are the interrupts with the lowest priority.


Pin initialization


After adding the pin name to be used to the pin configuration table, you can use this table to initialize the pin.


PIN called during pin initialization_ The init() function is completed. In TI routines, this function calls Board in the main function_ Init function.


Let's go in Board_ Init() function.

To PIN_ PIN passed in PIN_ init() function_ The pins in the Config table will be configured as GPIO pins and have the added pin attributes.


No PIN_ All pins in the Config table will be configured to the status of both input and output disabled.


Note: In the same application, PIN_ init() cannot be called multiple times.


After the above PIN initialization is completed, we can use the driver/PIN The API provided in the h file uses these pins. If we want to use some pins directly, we can call the PIN_ The open() function is not recommended in applications with operating systems, because it is not thread safe.

Share to:
401, XinBaoYuan Building, N5179, District 74 Xin'an Street, BaoAn District, Shenzhen, China 518101
Contact number:    +86-186 8898 9755
Global Sales Contact
Contact :    Kanta
Email :   info@coralradio.com