AnsweredAssumed Answered

USB CDC by STM32f767zi

Question asked by Mohsen on Aug 4, 2016

I have Nucleo board with STM32f767zi MCU. I use STM32CubeMX and Atollic TrueStudio for ARM. I want to use CDC to communicate with PC.

First, the code is not working. I changed the stack size to 2000 and heap size to 4000. Also I moved the defenition of CDC_Receive_FS function from .c to .h. Also Ichange the USB frequency to 48Mhz.

now, I can send data to PC. I tried to recieve a data from pc and resend it. I wrote following code:

#include "stm32f7xx_hal.h"
#include "usb_device.h"
#include "usbd_cdc_if.h"
void SystemClock_Config(void);
void Error_Handler(void);
static void MX_GPIO_Init(void);
int main(void)
  int8_t status;
  uint8_t myBuffer[7]="Start!";
  uint32_t L1;
  /* Initialize all configured peripherals */
  uint8_t HiMsg[]="Start\r\n";
  while (1)
      L1= strlen(myBuffer);
      status = CDC_Receive_FS(myBuffer, 5);
      CDC_Transmit_FS(myBuffer, 7);

when I tyoe '3', '33' , '333' ... in terminal. I see same respoce '╜3¬'. when I type '8', '88', '888' ... I see '╜8AmΩ'

I do not know what is wrong.