2017-01-30 09:23 AM
Hey there,
I am trying to put up a VCP for Nucleo144 STM32F429 and had hard time figuring out why i cannot connect with my Terminal Program board with the CubeMX generated Sourcecode.
I dont know why but this worked for me now:
In CubeMX:
Board Selection->STM32->Nucleo144->F429ZI
Pinout Tab:
Peripherals:
USB_OTG_FS->Device Only
RCC->Enable HSE->Bypass
MiddleWares:
Enable USB_DEVICE->Communication Device Class(Virtual Com Port)
Clock Configuration:
PLL Source Mux: HSE 8MHz /M= 4, *N = 168, /P = 2, /Q =7
System Clock Mux: PLLCLK-> 168MHz
APB1 peripheral clocks 42 MHz
Configuration Tab:
Connectivity->USB_FS->Parameter Settings->VBUS Sensing-> Disabled
Project Settings->Linker Settings:
Heap from 0x200 to 0x2000
Stack from 0x400 to 0x600
Project Settings
In IAR Embedded Workbench:
USB_HS_MAX_PACKET_SIZE from 512 to 256
CDC_DATA_HS_MAX_PACKET_SIZE from 512 to 256
(this doesnt really affected the problem so i changed it back to 512 since im using FS-mode)
Still I cannot connect via a Terminal from Host PC.
So i searched and now this happens:
Back in CubeMX taking a harder look at USB_DEVICE in Configuartion Tab.
I changed USBD_MAX_STR_DESC_SIZ the default 512 to 64 bytes, because description says between 1 and 64. Why default is 512 then?
->Still cannot connect.
Changed USBD_DEBUG_LEVEL to 3.
I finally can connect to device via Terminal.
I will try to rebuild this scenario tomorrow to see if this option really making me that trouble.
Could these settings have such impact on the right configuration?
2017-01-30 01:55 PM
Hi,
Try to change the buffers size and HS max packet size from 512 to 64, as t
he maximum packet size for full speed devices is 64 bytes.
Also, i
ncrease the heap and stack size.Please keep me updated on your
scenario results.
Imen
2017-01-31 12:51 AM
stack and heap size were increased...
the buffer and packet size should only affect when i start with transmit and receive calls?
I made quick rebuild this morning with following result:
Rebuild:
CubeMx
Board Selection->STM32->Nucleo144->F429ZI
Pinout Tab:
Peripherals:
USB_OTG_FS->Device Only
RCC->Enable HSE->Bypass
MiddleWares:
Enable USB_DEVICE->Communication Device Class(Virtual Com Port)
Clock Configuration:
PLL Source Mux: HSE 8MHz /M= 4, *N = 168, /P = 2, /Q =7
System Clock Mux: PLLCLK-> 168MHz
APB1 peripheral clocks 42 MHz
USB_FS Configuration
VBUS sensing Disable
USB_DEVICE Configuration
USBD_MAX_STR_DESC_SIZ from 512 to 64
USBD_DEBUG_LEVEL to 3
Project Settings:
->HAL Settings: Enable Full Assert
->Code Generator: Copy only the necessary libary files
Generate Code
In IAR no changes…
I made no Transmit or Receive calls and i can connect to device via terminal program.
CubeMX -> USBD_DEBUG_LEVEL to 0
Generate Code
In IAR no changes..
I made no Transmit or Receive calls and i get Error in Terminal programm
CubeMX -> USBD_DEBUG_LEVEL to 1
I made no Transmit or Receive calls and i get Error in Terminal programm
CubeMX -> USBD_DEBUG_LEVEL to 2
I made no Transmit or Receive calls and i can connect to device
So there must be any effect of USBD_DEBUG_LEVEL to initialization or connection?
I will know test Transmit and Receiving on the working project and hope upcoming problems
can be more easily managed then this one.
2017-01-31 03:47 AM
In the working project i just added a few lines source code to generate a array with Data which i send after a Delay
with the CDC_Transmit_FS():
while (1)
{ HAL_Delay(1000); CDC_Transmit_FS(testData, 8);}
without any changes to Buffer etc. actually i am wondering this works because I made no changes to the generated source code.
USB_HS_MAX_PACKET_SIZE and CDC_DATA_HS_MAX_PACKET_SIZE are still 512
and APP_RX_DATA_SIZE and APP_TX_DATA_SIZE is still 4
why is it working?