UART Driver with UART4/5

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Triest
Posts: 4
Joined: Sat Dec 06, 2014 7:16 pm

UART Driver with UART4/5

Post by Triest »

I'm trining to get the UART4/5 to work with the USART Drivers, but i'm unable to get any output from UART4. All example on the internet are using USART1, USART2, USART3 or USART6. So im wondering if the current Version (2.6.6) supportes USART Drivers with UART4/5. Do you have any exmple code or suggestions thats use USART4/5? Also i have tried to get the Serial Driver working with UART4:

Code: Select all

#include "ch.h"
#include "hal.h"
#include "chprintf.h"

static SerialConfig sd_cfg = { 115200, 0, 0, 0 };

int main(void) {
   halInit();
   chSysInit();

   sdStart(&SD4, &sd_cfg);
   palSetPadMode(GPIOC, 10, PAL_MODE_ALTERNATE(7));
   palSetPadMode(GPIOC, 11, PAL_MODE_ALTERNATE(7));

   chprintf((BaseSequentialStream *) &SD4, "Hello, World! \n");
}


Any help would be appreciated.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: UART Driver with UART4/5

Post by Giovanni »

Hi,

Make sure that those pins are not connected on the board to something else there could be a conflict, also check connections.

In order to check the driver functionality you may put a breakpoint in the ISR, see serial_lld.c, if that is reached then the driver is working.

Giovanni
Triest
Posts: 4
Joined: Sat Dec 06, 2014 7:16 pm

Re: UART Driver with UART4/5

Post by Triest »

Ok every thing is working fine with the right alternate function :/

Code: Select all

int main(void) {
   halInit();
   chSysInit();

   sdStart(&SD4, &sd_cfg);
   palSetPadMode(GPIOA, 0, PAL_MODE_ALTERNATE(8));
   palSetPadMode(GPIOA, 1, PAL_MODE_ALTERNATE(8));

   while (1) {
      chprintf((BaseSequentialStream *) &SD4, "Hello, World! \n");
   }
}
Post Reply