diff mbox

[U-Boot,3/3] stm32: Change USART port to USART6 for stm32f746 discovery board

Message ID 20160707160226.4145-4-tnishinaga.dev@gmail.com
State Accepted
Commit 4b2fd720a7b2f78c42d1565edf4c67f378c65440
Delegated to: Tom Rini
Headers show

Commit Message

Toshifumi NISHINAGA July 7, 2016, 4:02 p.m. UTC
From: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>

This change is to remove a halt at about 200KiB
while sending a large(1MiB) binary to a micro controller using USART1.
USART1 is connected to a PC via an on-board ST-Link debugger
that also functions as a USB-Serial converter.
However, it seems to loss some data occasionally.
So I changed the serial port to USART6 and connected it to the PC using
an FTDI USB-Serial cable, therefore the transmission was successfully
completed.

Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
---
 arch/arm/include/asm/arch-stm32f7/stm32_periph.h |  2 ++
 arch/arm/mach-stm32/stm32f7/clock.c              |  3 +++
 board/st/stm32f746-disco/stm32f746-disco.c       | 13 ++++++-------
 3 files changed, 11 insertions(+), 7 deletions(-)

Comments

Tom Rini July 16, 2016, 1:51 p.m. UTC | #1
On Fri, Jul 08, 2016 at 01:02:26AM +0900, tnishinaga.dev@gmail.com wrote:

> From: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> 
> This change is to remove a halt at about 200KiB
> while sending a large(1MiB) binary to a micro controller using USART1.
> USART1 is connected to a PC via an on-board ST-Link debugger
> that also functions as a USB-Serial converter.
> However, it seems to loss some data occasionally.
> So I changed the serial port to USART6 and connected it to the PC using
> an FTDI USB-Serial cable, therefore the transmission was successfully
> completed.
> 
> Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>

Applied to u-boot/master, thanks!
Vikas MANOCHA July 20, 2016, 9:59 p.m. UTC | #2
Hi Tom,

> -----Original Message-----
> From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Tom Rini
> Sent: Saturday, July 16, 2016 6:51 AM
> To: tnishinaga.dev@gmail.com
> Cc: u-boot@lists.denx.de; gregkh@linuxfoundation.org
> Subject: Re: [U-Boot] [U-Boot, 3/3] stm32: Change USART port to USART6 for
> stm32f746 discovery board
> 
> On Fri, Jul 08, 2016 at 01:02:26AM +0900, tnishinaga.dev@gmail.com wrote:
> 
> > From: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> >
> > This change is to remove a halt at about 200KiB while sending a
> > large(1MiB) binary to a micro controller using USART1.
> > USART1 is connected to a PC via an on-board ST-Link debugger that also
> > functions as a USB-Serial converter.
> > However, it seems to loss some data occasionally.
> > So I changed the serial port to USART6 and connected it to the PC
> > using an FTDI USB-Serial cable, therefore the transmission was
> > successfully completed.
> >
> > Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> 
> Applied to u-boot/master, thanks!

There is no serial/usb connector on discovery board to use USART6 signals.
With this patch, it is not possible to get discovery console without additional circuit. Please revert this patch.
Also I did a quick check on transferring 2.6MB binary using usart1 without any issue.

Hi Toshifumi,
Please keep all involved developers in the "To" of the patch e-mails (checkout scripts/get_maintainer.pl).

Cheers,
Vikas

> 
> --
> Tom
Tom Rini July 21, 2016, 7:39 p.m. UTC | #3
On Wed, Jul 20, 2016 at 11:59:32PM +0200, Vikas MANOCHA wrote:
> Hi Tom,
> 
> > -----Original Message-----
> > From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Tom Rini
> > Sent: Saturday, July 16, 2016 6:51 AM
> > To: tnishinaga.dev@gmail.com
> > Cc: u-boot@lists.denx.de; gregkh@linuxfoundation.org
> > Subject: Re: [U-Boot] [U-Boot, 3/3] stm32: Change USART port to USART6 for
> > stm32f746 discovery board
> > 
> > On Fri, Jul 08, 2016 at 01:02:26AM +0900, tnishinaga.dev@gmail.com wrote:
> > 
> > > From: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> > >
> > > This change is to remove a halt at about 200KiB while sending a
> > > large(1MiB) binary to a micro controller using USART1.
> > > USART1 is connected to a PC via an on-board ST-Link debugger that also
> > > functions as a USB-Serial converter.
> > > However, it seems to loss some data occasionally.
> > > So I changed the serial port to USART6 and connected it to the PC
> > > using an FTDI USB-Serial cable, therefore the transmission was
> > > successfully completed.
> > >
> > > Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> > 
> > Applied to u-boot/master, thanks!
> 
> There is no serial/usb connector on discovery board to use USART6 signals.
> With this patch, it is not possible to get discovery console without additional circuit. Please revert this patch.
> Also I did a quick check on transferring 2.6MB binary using usart1 without any issue.

Done, sorry about that.
Vikas MANOCHA July 22, 2016, 1:12 a.m. UTC | #4
Thanks Tom

> On Jul 21, 2016, at 12:39 PM, Tom Rini <trini@konsulko.com> wrote:
> 
>> On Wed, Jul 20, 2016 at 11:59:32PM +0200, Vikas MANOCHA wrote:
>> Hi Tom,
>> 
>>> -----Original Message-----
>>> From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Tom Rini
>>> Sent: Saturday, July 16, 2016 6:51 AM
>>> To: tnishinaga.dev@gmail.com
>>> Cc: u-boot@lists.denx.de; gregkh@linuxfoundation.org
>>> Subject: Re: [U-Boot] [U-Boot, 3/3] stm32: Change USART port to USART6 for
>>> stm32f746 discovery board
>>> 
>>>> On Fri, Jul 08, 2016 at 01:02:26AM +0900, tnishinaga.dev@gmail.com wrote:
>>>> 
>>>> From: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
>>>> 
>>>> This change is to remove a halt at about 200KiB while sending a
>>>> large(1MiB) binary to a micro controller using USART1.
>>>> USART1 is connected to a PC via an on-board ST-Link debugger that also
>>>> functions as a USB-Serial converter.
>>>> However, it seems to loss some data occasionally.
>>>> So I changed the serial port to USART6 and connected it to the PC
>>>> using an FTDI USB-Serial cable, therefore the transmission was
>>>> successfully completed.
>>>> 
>>>> Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
>>> 
>>> Applied to u-boot/master, thanks!
>> 
>> There is no serial/usb connector on discovery board to use USART6 signals.
>> With this patch, it is not possible to get discovery console without additional circuit. Please revert this patch.
>> Also I did a quick check on transferring 2.6MB binary using usart1 without any issue.
> 
> Done, sorry about that.
> 
> -- 
> Tom
>
Toshifumi NISHINAGA July 29, 2016, 1:23 p.m. UTC | #5
Hi Vikas,

2016-07-21 6:59 GMT+09:00 Vikas MANOCHA <vikas.manocha@st.com>:

> Hi Tom,
>
> > -----Original Message-----
> > From: U-Boot [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Tom Rini
> > Sent: Saturday, July 16, 2016 6:51 AM
> > To: tnishinaga.dev@gmail.com
> > Cc: u-boot@lists.denx.de; gregkh@linuxfoundation.org
> > Subject: Re: [U-Boot] [U-Boot, 3/3] stm32: Change USART port to USART6
> for
> > stm32f746 discovery board
> >
> > On Fri, Jul 08, 2016 at 01:02:26AM +0900, tnishinaga.dev@gmail.com
> wrote:
> >
> > > From: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> > >
> > > This change is to remove a halt at about 200KiB while sending a
> > > large(1MiB) binary to a micro controller using USART1.
> > > USART1 is connected to a PC via an on-board ST-Link debugger that also
> > > functions as a USB-Serial converter.
> > > However, it seems to loss some data occasionally.
> > > So I changed the serial port to USART6 and connected it to the PC
> > > using an FTDI USB-Serial cable, therefore the transmission was
> > > successfully completed.
> > >
> > > Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
> >
> > Applied to u-boot/master, thanks!
>
> There is no serial/usb connector on discovery board to use USART6 signals.
> With this patch, it is not possible to get discovery console without
> additional circuit. Please revert this patch.
> Also I did a quick check on transferring 2.6MB binary using usart1 without
> any issue.
>


I'm so sorry for the lack of confirmation.
I checked on transferring 1.5MB data using usart1 without any issue.
Thank you for checking my patch.



> Hi Toshifumi,
> Please keep all involved developers in the "To" of the patch e-mails
> (checkout scripts/get_maintainer.pl).
>
>
I understand.
Thank you.

Cheers,
Toshifumi
diff mbox

Patch

diff --git a/arch/arm/include/asm/arch-stm32f7/stm32_periph.h b/arch/arm/include/asm/arch-stm32f7/stm32_periph.h
index 38adc4e..0bd4695 100644
--- a/arch/arm/include/asm/arch-stm32f7/stm32_periph.h
+++ b/arch/arm/include/asm/arch-stm32f7/stm32_periph.h
@@ -17,11 +17,13 @@ 
 enum periph_id {
 	UART1_GPIOA_9_10 = 0,
 	UART2_GPIOD_5_6,
+	UART6_GPIOC_6_7,
 };
 
 enum periph_clock {
 	USART1_CLOCK_CFG = 0,
 	USART2_CLOCK_CFG,
+	USART6_CLOCK_CFG,
 	GPIO_A_CLOCK_CFG,
 	GPIO_B_CLOCK_CFG,
 	GPIO_C_CLOCK_CFG,
diff --git a/arch/arm/mach-stm32/stm32f7/clock.c b/arch/arm/mach-stm32/stm32f7/clock.c
index 78d22d4..ac47850 100644
--- a/arch/arm/mach-stm32/stm32f7/clock.c
+++ b/arch/arm/mach-stm32/stm32f7/clock.c
@@ -245,6 +245,9 @@  void clock_setup(int peripheral)
 	case USART1_CLOCK_CFG:
 		setbits_le32(RCC_BASE + RCC_APB2ENR, RCC_ENR_USART1EN);
 		break;
+	case USART6_CLOCK_CFG:
+		setbits_le32(RCC_BASE + RCC_APB2ENR, RCC_ENR_USART6EN);
+		break;
 	case GPIO_A_CLOCK_CFG:
 		setbits_le32(RCC_BASE + RCC_AHB1ENR, RCC_ENR_GPIO_A_EN);
 		break;
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
index 404fdfa..47aa058 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -32,7 +32,7 @@  const struct stm32_gpio_ctl gpio_ctl_usart = {
 	.otype = STM32_GPIO_OTYPE_PP,
 	.speed = STM32_GPIO_SPEED_50M,
 	.pupd = STM32_GPIO_PUPD_UP,
-	.af = STM32_GPIO_AF7
+	.af = STM32_GPIO_AF8
 };
 
 const struct stm32_gpio_ctl gpio_ctl_fmc = {
@@ -251,8 +251,8 @@  int dram_init(void)
 }
 
 static const struct stm32_gpio_dsc usart_gpio[] = {
-	{STM32_GPIO_PORT_A, STM32_GPIO_PIN_9},	/* TX */
-	{STM32_GPIO_PORT_B, STM32_GPIO_PIN_7},	/* RX */
+	{STM32_GPIO_PORT_C, STM32_GPIO_PIN_6},	/* TX */
+	{STM32_GPIO_PORT_C, STM32_GPIO_PIN_7},	/* RX */
 };
 
 int uart_setup_gpio(void)
@@ -260,8 +260,7 @@  int uart_setup_gpio(void)
 	int i;
 	int rv = 0;
 
-	clock_setup(GPIO_A_CLOCK_CFG);
-	clock_setup(GPIO_B_CLOCK_CFG);
+	clock_setup(GPIO_C_CLOCK_CFG);
 	for (i = 0; i < ARRAY_SIZE(usart_gpio); i++) {
 		rv = stm32_gpio_config(&usart_gpio[i], &gpio_ctl_usart);
 		if (rv)
@@ -273,7 +272,7 @@  out:
 }
 
 static const struct stm32x7_serial_platdata serial_platdata = {
-	.base = (struct stm32_usart *)USART1_BASE,
+	.base = (struct stm32_usart *)USART6_BASE,
 	.clock = CONFIG_SYS_CLK_FREQ,
 };
 
@@ -292,7 +291,7 @@  int board_early_init_f(void)
 	int res;
 
 	res = uart_setup_gpio();
-	clock_setup(USART1_CLOCK_CFG);
+	clock_setup(USART6_CLOCK_CFG);
 	if (res)
 		return res;