Sep 23, 2020
06:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2020
06:21 AM
Hello,
I am trying to get the board to send a string message via Serial, but am a bit lost on how to do it.
Ideally, I would want it so that when I connect to the board (appears as COM4 on my computer), a string is printed ("Hello, world" for instance)
I found an example code which I tried but it doesn't seem to work: (From an example named "HelloSerial" By Hightec):
In my code I run (after running _init_uart):
Now, When I integrate it into my code, nothing happens. I run the code, connect with Putty to COM4 and see a blank)
I think I might be missing something here. Is there any good example I can see? I just need to simply send a message via serial/uart, no need to receive anything
I would appreciate any help, Thank you!
I am using the Tasking compiler.
For reference, this is _init_uart():
I am trying to get the board to send a string message via Serial, but am a bit lost on how to do it.
Ideally, I would want it so that when I connect to the board (appears as COM4 on my computer), a string is printed ("Hello, world" for instance)
I found an example code which I tried but it doesn't seem to work: (From an example named "HelloSerial" By Hightec):
_init_uart(BAUDRATE);
my_puts("Example String");
In my code I run (after running _init_uart):
static Ifx_P * const port = (Ifx_P *)&MODULE_P15;
static Ifx_ASCLIN * const asclin0 = (Ifx_ASCLIN *)&MODULE_ASCLIN0;
#define UARTBASE asclin0
#define TX_CLEAR(u) ((u)->FLAGSCLEAR.U = (IFX_ASCLIN_FLAGSCLEAR_TFLC_MSK << IFX_ASCLIN_FLAGSCLEAR_TFLC_OFF))
#define PUT_CHAR(u, c) ((u)->TXDATA.U = (c))
void _out_uart(const unsigned char chr)
{
TX_CLEAR(UARTBASE);
PUT_CHAR(UARTBASE, chr);
}
Now, When I integrate it into my code, nothing happens. I run the code, connect with Putty to COM4 and see a blank)
I think I might be missing something here. Is there any good example I can see? I just need to simply send a message via serial/uart, no need to receive anything
I would appreciate any help, Thank you!
I am using the Tasking compiler.
For reference, this is _init_uart():
void _init_uart(int baudrate)
{
unsigned int numerator;
unsigned int denominator;
unsigned int pisel = 0;
#if (RUN_ON_APPKIT == 1)
/* on board wiggler is connected to ASCLIN0 */
/* ARX0A/P14.1 (RXD), ATX0/P14.0 (TXD) */
/* Set TXD/P14.0 to "output" and "high" */
port->IOCR0.B.PC0 = OUT_PPALT2;
port->OMR.B.PS0 = 1;
#elif (ON_SHIELDBUDDY == 1)
/* on board wiggler is connected to ASCLIN3 */
/* ARX3D/P32.2 (RXD), ATX3/P15.7 (TXD) */
/* Set TXD/P15.7 to "output" and "high" */
port->IOCR4.B.PC7 = OUT_PPALT2;
port->OMR.B.PS7 = 1;
/* select ARXnD */
pisel = 3;
#else
/* on board wiggler is connected to ASCLIN0 */
/* ARX0B/P15.3 (RXD), ATX0/P15.2 (TXD) */
/* Set TXD/P15.2 to "output" and "high" */
port->IOCR0.B.PC2 = OUT_PPALT2;
port->OMR.B.PS2 = 1;
/* select ARXnB */
pisel = 1;
#endif /* RUN_ON_APPKIT */
/* baudrate values at 100 MHz */
denominator = 3125;
switch (baudrate)
{
case 9600 : numerator = BAUD_9600; break;
case 19200 : numerator = BAUD_19200; break;
default :
case 38400 : numerator = BAUD_38400; break;
case 57600 : numerator = BAUD_57600; break;
case 115200 : numerator = BAUD_115200; break;
}
/* Enable ASCn */
unlock_wdtcon();
UARTBASE->CLC.U = 0;
/* TXD and RXD pins: automotive level, fast */
#if (RUN_ON_APPKIT == 1)
/* ARX0A/P14.1 (RXD), ATX0/P14.0 (TXD) */
port->PDR0.B.PD0 = 0;
port->PDR0.B.PD1 = 0;
#elif (ON_SHIELDBUDDY == 1)
/* ARX3D/P32.2 (RXD), ATX3/P15.7 (TXD) */
P32_PDR0.B.PD2 = 0;
P15_PDR0.B.PD7 = 0;
#else
/* ARX0B/P15.3 (RXD), ATX0/P15.2 (TXD) */
port->PDR0.B.PD2 = 0;
port->PDR0.B.PD3 = 0;
#endif /* RUN_ON_APPKIT */
lock_wdtcon();
/* read back for activating module */
(void)UARTBASE->CLC.U;
/* select RXD as input pin */
UARTBASE->IOCR.B.ALTI = pisel;
/* Program ASC0 */
UARTBASE->CSR.U = 0;
/* configure TX and RX FIFOs */
UARTBASE->TXFIFOCON.U = (1 << 6) /* INW: (1 == 1 byte) */
| (1 << 1) /* ENO */
| (1 << 0); /* FLUSH */
UARTBASE->RXFIFOCON.U = (1 << 6) /* OUTW: (1 == 1 byte) */
| (1 << 1) /* ENI */
| (1 << 0); /* FLUSH */
UARTBASE->BITCON.U = ( 9 << 0) /* PRESCALER: 10 */
| (15 << 16) /* OVERSAMPLING: 16 */
| ( 9 << 24) /* SAMPLEPOINT: position 7,8,9 */
| (1u << 31); /* SM: 3 samples per bit */
/* data format: 8N1 */
UARTBASE->FRAMECON.U = (1 << 9) /* STOP: 1 bit */
| (0 << 16) /* MODE: Init */
| (0 << 30); /* PEN: no parity */
UARTBASE->DATCON.U = (7 << 0); /* DATLEN: 8 bit */
/* set baudrate value */
UARTBASE->BRG.U = (denominator << 0) /* DENOMINATOR */
| (numerator << 16); /* NUMERATOR */
UARTBASE->FRAMECON.B.MODE = 1; /* ASC mode */
UARTBASE->CSR.U = 1; /* select CLC as clock source */
TX_START(UARTBASE);
}
7 Replies
Sep 23, 2020
07:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2020
07:01 AM
I would recommend to confirm that you are on the correct COM port and insure that USB com driver has VCP checked.

Sep 23, 2020
07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2020
07:12 AM
cwunder wrote:
I would recommend to confirm that you are on the correct COM port and insure that USB com driver has VCP checked.
Thanks for the answer 🙂
I am on the correct COM port (and the computer detects the connection, just nothing is printed)
I know the connection is detected since I can connect with PuTTY (with nothing happening) and if I disconnect the cable the session disconects.
I can't seem to find the VCP option for some reason:
Seems to be no "advanced" option
Again thanks for the help!
Sep 23, 2020
08:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2020
08:16 AM
You can access examples https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples
For the VCP setting you need to click on the USB settings not the COM settings.
For the VCP setting you need to click on the USB settings not the COM settings.
Sep 23, 2020
08:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2020
08:52 AM
cwunder wrote:
You can access examples https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples
For the VCP setting you need to click on the USB settings not the COM settings.
VCP was enabled. Checked now 🙂
And thanks for the link!
know which one is supposed to work on my board?
I see multiple examples but since my board is an application kit (TC2x7) I am not sure which will work since there is no specific number:
Also, I see there are 2 types. What is the difference? what does the "shell" variant do?
Does it send actual viewable text? Or is the difference something else
Sep 23, 2020
09:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 23, 2020
09:00 AM
Check the device which is assembled. This should be a TC277 or TC297. Dependent of this you use the corresponding demo.
Sep 24, 2020
04:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 24, 2020
04:25 AM
MoD wrote:
Check the device which is assembled. This should be a TC277 or TC297. Dependent of this you use the corresponding demo.
Thanks!
I think I got the correct demo to go by.
I was looking at the code for ASCLIN_Shell_UART_1_KIT_TC297_TFT and saw that there is an initialization of both "console" and "shell"
If all I need to do is to print one message a single time when someone connects via Serial, and have no need in receiving data at all, Is initializing the console enough? Or is the shell still needed?
Meaning, is running Ifx_Console_init() and using console printing correctly enough? Or is the part relating to Ifx_Shell_init() also needed
Again many thanks for the answer.
Sep 24, 2020
06:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 24, 2020
06:40 AM
For print out only the console should be enough.
This widget could not be displayed.