cancel
Showing results for 
Search instead for 
Did you mean: 

SOLVED ..stm32f7-discovery board and VCP usart1

hjh
Associate III
Posted on April 24, 2016 at 19:02

hi

I try to setup serial trough y´the USART1 on stm32f7-discovery using cubemx to make the project.

When using usart6 everything works fine but with usart1 trough vcp i can not get it up and running.

in my main.c i have only made 3 lines of code ..everything else come from cubemx

Wha can the problem be ?

/* Initialize all configured peripherals */

  MX_GPIO_Init();

  MX_USART6_UART_Init();

  MX_USART1_UART_Init();

  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */

  /* USER CODE BEGIN WHILE */

       while (1)

       {

      uint8_t data[20] = ''test \n\r'';

      HAL_UART_Transmit(&huart6,data,20,1000);

      HAL_UART_Transmit(&huart1,data,20,1000);
7 REPLIES 7
slimen
Senior
Posted on April 25, 2016 at 12:41

Hi,

Please try to share your .ioc file and mention which CubeMX version you have used.

Regards

hjh
Associate III
Posted on April 25, 2016 at 18:10

hi

Thanks for looking into this ...

cubemx 4.0 and the board are stm32f7g-discovery MB1191B

I did only add the 3 lines you see in above post.

in my serial program i can see the VCP port but no reaction.

Hjalmar

________________

Attachments :

uart4.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzcu&d=%2Fa%2F0X0000000bOa%2FI44Xn8P2b6Iaj0OlpAyV5DSjst9uTrFChwotsiNZ67E&asPdf=false
hjh
Associate III
Posted on April 25, 2016 at 18:53

hi

now updated to 4.0 ..

only add 3 lines of code

nothing changed ...usart6 works very fine but usart1 trough VCP do not

SystemClock_Config();

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_USART1_UART_Init();

MX_USART6_UART_Init();

/* USER CODE BEGIN 2 */

/* USER CODE END 2 */

/* Infinite loop */

/* USER CODE BEGIN WHILE */

while (1)

{

uint8_t data[20] = ''test \n\r'';

HAL_UART_Transmit(&huart6,data,20,1000);

HAL_UART_Transmit(&huart1,data,20,1000);

/* USER CODE END WHILE */

________________

Attachments :

usart1_6_test.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzcp&d=%2Fa%2F0X0000000bOb%2FPQA64tUDwvfhZ9V4OwHQNKdibpwWVf8h7A_wEk0yb1c&asPdf=false
hjh
Associate III
Posted on April 29, 2016 at 07:53

Hi

No more help from ST on this very important issue ...

it is a very easy way to transmit data to pc without making ftdi etc ..

Hjalmar

Walid FTITI_O
Senior II
Posted on April 29, 2016 at 13:30

Hi skovholm_hansen.hjal,

Try to select SYSCKL as USART1 clock source and tell me if this resolve the issue ?

-Hannibal-
hjh
Associate III
Posted on May 02, 2016 at 17:30

SUPER ........SOLVED ...

It works like a charm ...But sorry where to find that information ?

Can you please pin point out the mage in the manual for the chip ?

Just so i can find such answers my self in the future ...

Thanks...you make my day ;o)

Hjalmar

Posted on May 10, 2016 at 20:53

You can also use CubeMX to configure USART1 however the default parameters are wrong.  The data width needs to be changed from 7 bits to 8 bits, and the Tx pin needs to be changed from the default to PA9. It should then drive the VCP through ST-Link