cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling second uart in my custom board using stm32mp157a processor at uboot level?

Sindhu Vadde
Associate III

Hi,

We configured 1 uart for debugging purpose in our custom board at u boot level. Now we want to configure anthour uart for communicating with other devices.how do we configure second uart? For debug uart we use serial_putc() for transmit and serial_getc() for receiving .what are drivers we should use for transmit and receive data for second uart?

1 REPLY 1
PatrickD
ST Employee

Hi,

the UART instances are configurated in the device tree.

For example on ST board, a second uart instance (usart3) is present on extension connector but deactivated by default....

this UART can be used in U-Boot just by enable the already existing node in boar device tree:

&usart3 {

status = "okay";

};

serial_getc()/serial_putc() = it is API to manage the serial console, i.e the current selected device

(gd->cur_serial_dev)

For direct access to other serial device, you shoul use directly the serial UCLASS ops.

A example of usage can be found in /arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c,

something like :

if (uclass_get_device_by_seq(UCLASS_SERIAL, instance, &dev)) {

log_err("serial %d device not found\n", instance);

return -ENODEV;

}

ops = serial_get_ops(dev);

ops->setconfig(dev, serial_config);

......

err = ops->getc(down_serial_dev);

  err = ops->putc(down_serial_dev, w_byte);

see U-Class for ops complete API description in include/serial.h

/**

 * struct struct dm_serial_ops - Driver model serial operations

 *

 * The uclass interface is implemented by all serial devices which use

 * driver model.

 */

struct dm_serial_ops {

...

Regards

Patrick