cancel
Showing results for 
Search instead for 
Did you mean: 

USB CDC on microC/OS II?

jon239955_stm1_stmicro
Associate II
Posted on June 29, 2016 at 03:30

I've generated a test app using STM32Cube for a STM32F407 Discovery board and have been able to send and receive.  I am now trying to port the code to run under microC/OS II.  I have modified the ISR to include the uC/OS additions and have also replaced calls to HAL_Delay() with OSTimerDly() however the port is not being created for the ported project.  Any ideas on what I'm missing?  The MX_USB_DEVICE_Init doing all its calls with no error returns.

void STM32F4_InterruptController::OTG_FS_IRQHandler(void)

{

   extern PCD_HandleTypeDef hpcd_USB_OTG_FS;

   OS_CPU_SR  cpu_sr = 0;

   OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */

   OSIntNesting++;

   OS_EXIT_CRITICAL();

   HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);

   OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */

}

----------------------

Code fragment from startup task in uC/OS

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

  HAL_Init();

  /* Configure the system clock */

  SystemClock_Config();

  /* Initialize all configured peripherals */

  MX_GPIO_Init();

  MX_USB_DEVICE_Init();

   HAL_Delay(1000); 

    /* CDC port is visible at this point in stand alone but not in uC/OS II version */

   uint8_t test_msg[]=''HELLO'';

   uint16_t size = strlen((char *)test_msg);

      

  /* Infinite loop to send data */

  while (1)

  {

...

 

#isr-ucosii #microc/os-ii #usb #cdc
2 REPLIES 2
jon239955_stm1_stmicro
Associate II
Posted on July 20, 2016 at 18:25

The problem turned out to be insufficient heap allocation.  changed from 512 to 4096 and it started working