Serial and Shell over UART how?

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
tsichevski
Posts: 35
Joined: Fri Feb 09, 2018 12:44 am
Has thanked: 2 times
Been thanked: 5 times

Serial and Shell over UART how?

Postby tsichevski » Mon Jun 11, 2018 9:52 pm

Hi,
I'm trying to implement:

1. printf() functions over UART
2. Shell over UART.

First, I have the UART2 enabled by setting:

HAL_USE_UART in halconf.h
UART_USE_WAIT in halconf.h
STM32_UART_USE_USART2 in mcuconf.h

so far so good, and I can successfully transmit and receive bytes with the uartSendXXX() and uartReceiveXXX() functions.

Now I'm trying to move toward using shell, so I have the serial driver enabled:

HAL_USE_SERIAL in halconf.h

but now I have the error:

../src/hal_uart_lld.c:349: multiple definition of `VectorD8'
../src/hal_serial_lld.c:322: first defined here

What do I wrong?

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Serial and Shell over UART how?

Postby Giovanni » Tue Jun 12, 2018 5:08 am

Hi,

The serial driver is alternative to the UART driver, you just need the serial driver for this. There are several examples of shell over serial in demos and testhal that you could use as template.

Giovanni

tsichevski
Posts: 35
Joined: Fri Feb 09, 2018 12:44 am
Has thanked: 2 times
Been thanked: 5 times

Re: Serial and Shell over UART how?

Postby tsichevski » Tue Jun 12, 2018 12:44 pm

Thanks, Giovanni,

now I have managed to get the shell over serial compiled and running. But the data sent and receiver is invalid: I see two bytes received when I send just one. For example, if I send 0x61 (press 'a' in the screen program), I always receive the 0x78 and 0xf8 bytes, and so on.

If I use the UART driver, I do not experience such a problem.

I build with the ChibiOS 17.6.3. I noticed, the code to initialize the UART registers differ in the UART and SD drivers :(

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Serial and Shell over UART how?

Postby Giovanni » Tue Jun 12, 2018 1:14 pm

It is a configuration mismatch probably, try the default configuration (NULL in sdStart) that is always 38400-8-N-1.

Giovanni

tsichevski
Posts: 35
Joined: Fri Feb 09, 2018 12:44 am
Has thanked: 2 times
Been thanked: 5 times

Re: Serial and Shell over UART how?

Postby tsichevski » Tue Jun 12, 2018 2:56 pm

Tried this, it does not help :(

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Serial and Shell over UART how?

Postby Giovanni » Tue Jun 12, 2018 3:35 pm

So, which board are you using?

Giovanni


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 6 guests