background image

Implementation

Configure the Shell

To configure the Shell, it is needed to firstly initialize a Standard Interface and a Standard IO from the iLLDs. 
This is done by the functions 

IfxAsclin_Asc_stdIfDPipeInit()

Ifx_Console_init() 

and 

Ifx_Assert_setStandardIo()

, that can be found respectively in the iLLDs headers 

IfxAsclin_Asc.h

Ifx_Console.h 

and 

Assert.h

.

Furthermore, it is needed to define the macros 

IFX_CFG_ASSERT_STDIO

IFX_CFG_ASSERT_VERBOSE_LEVEL_DEFAULT 

and

IFX_CFG_ASSERT_INCLUDE 

to configure the 

Ifx_Assert.h 

header.

This is done in the configuration header 

Ifx_Cfg.h

.

The Shell is configured inside the function 

initShellInterface()

by initializing an instance of the 

Ifx_Shell_Config 

structure with default values through the function 

Ifx_Shell_initConfig()

. Then, the 

following parameters are modified:

standardIo 

– that allows to set the module used for serial communication

commandList 

– that allows to set the list of commands supported by the shell

The command list is an array of structures of the type 

Ifx_Shell_Command

, that contains:

commandLine 

– the actual command which will be sent to the shell by the user

help 

– a small description of the command that is shown when help command is given

data 

– a link to the shell

call 

– the function called when the command is given

The 

Ifx_Shell_init() 

function initializes the shell with the user configuration.

The functions 

Ifx_Shell_initConfig()

and 

Ifx_Shell_init()

can be found in the iLLD header 

Ifx_Shell.h

,  while 

the function 

initShellInterface()

is defined in the header 

UART_ASCLIN_Shell.h

.

6

2019-10-17

Copyright © Infineon Technologies AG 2019. All rights reserved.

Summary of Contents for ASCLIN Shell UART 1

Page 1: ...AURIX TC2xx Microcontroller Training V1 0 0 ASCLIN_Shell_UART_1 Shell via UART communication Please read the Important Notice and Warnings at the end of this document ...

Page 2: ...e is used to interface with the Shell through the USB port via UART The ASCLIN module is configured for UART communication The Shell from iLLDs exploits the ASCLIN module to interpret and manage commands from the user like info toggle x or help 2 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 3: ...ial communication with external devices In this example it is used to interface with the PC through the USB port via UART communication A Shell is a user interface for parsing commands and accessing services 3 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 4: ...This code example has been developed for the board KIT_AURIX_TC297_TFT_BC Step The board should be connected to the PC through the USB port 1 1 4 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 5: ...set txPriority rxPriority and erPriority the interrupt priorities for transmission reception and error events typeOfService the service provider responsible for handling the interrupt which can be any of the available CPUs or the DMA pins a structure that allows to set which port pins are used for the communication rxBuffer rxBufferSize txBuffer txBufferSize parameters that allow to configure the ...

Page 6: ... default values through the function Ifx_Shell_initConfig Then the following parameters are modified standardIo that allows to set the module used for serial communication commandList that allows to set the list of commands supported by the shell The command list is an array of structures of the type Ifx_Shell_Command that contains commandLine the actual command which will be sent to the shell by ...

Page 7: ...haracter is entered Configure and control the LEDs The LEDs are toggled by controlling the port pins to which they are connected using methods from the iLLD headers IfxPort h The LED port pins have to be configured to output push pull mode using the function IfxPort_setPinMode During program execution the LEDs are switched on and off using the function IfxPort_setPinState 7 2019 10 17 Copyright In...

Page 8: ...he macro IFX_INTERRUPT isr vectabNum priority Since the Shell uses the ASCLIN module to interface with the user three ISR are needed to be configured for transmission reception and error events Each of the ISR should call the handler for the respective operation transmit receive or error by passing the ASC handle 8 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 9: ...or must be configured with the following parameters to enable the communication between the board and the PC Port COMx e g COM5 COM port number depends on the setup Baud rate 115200 Data bits 8 Parity None Stop bits 1 Handshaking None 9 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 10: ...vice perform the following steps Type help to see the list of available commands Type toggle 0 1 2 3 4 to respectively turn on all LEDs toggle LED D107 toggle LED D108 toggle LED D109 or toggle LED D110 Check command execution 10 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 11: ... www infineon com aurix expert training AURIX Development Studio is available online https www infineon com aurixdevelopmentstudio Use the Import function to get access to more code examples For questions and support use the AURIX Forum https www infineonforums com forums 13 Aurix Forum 11 2019 10 17 Copyright Infineon Technologies AG 2019 All rights reserved ...

Page 12: ...f the product for the intended application and the completeness of the product information given in this document with respect to such application For further information on the product technology delivery terms and conditions and prices please contact your nearest Infineon Technologies office www infineon com WARNINGS Due to technical requirements products may contain dangerous substances For inf...

Reviews: