Page 1 of 1

Serial and Shell over UART how?

Posted: Mon Jun 11, 2018 9:52 pm
by tsichevski
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?

Re: Serial and Shell over UART how?

Posted: Tue Jun 12, 2018 5:08 am
by Giovanni
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

Re: Serial and Shell over UART how?

Posted: Tue Jun 12, 2018 12:44 pm
by tsichevski
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 :(

Re: Serial and Shell over UART how?

Posted: Tue Jun 12, 2018 1:14 pm
by Giovanni
It is a configuration mismatch probably, try the default configuration (NULL in sdStart) that is always 38400-8-N-1.

Giovanni

Re: Serial and Shell over UART how?

Posted: Tue Jun 12, 2018 2:56 pm
by tsichevski
Tried this, it does not help :(

Re: Serial and Shell over UART how?

Posted: Tue Jun 12, 2018 3:35 pm
by Giovanni
So, which board are you using?

Giovanni