2019-08-21 07:56 AM
Hello,
I am working on the customized board with MCU STM32F767 + + LAN8742A + freeRTOS. The USB MSC host was working if no TCP server code was added. But when I add the TCP code, MSC is not working any more.
The code is as below:
if tcpip_init(NULL, NULL); is commented, USB host can work, I can write file to the USB MSC. but if uncommented, the code never run to the HOST_USER_CLASS_ACTIVE and disk cannot mounted in the USBH_UserProcess2(). So far I can see the function static USBH_StatusTypeDef USBH_MSC_Process(USBH_HandleTypeDef *phost) is not called. Is it caused by the freertos? anyone has similar issue and how to solve it?
Thanks
static void StartDefaultTask(void const * argument)
{
MX_GPIO_Init();
// tcpip_init(NULL, NULL);
// Netif_Config();
// tcpecho_init();
osThreadDef(MSC_Thread, MSCTask, osPriorityHigh, 0, 1 * configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(MSC_Thread), NULL);
for(;;)
{}
}
/**
* @brief USBH_UserProcess2
* @param phost: MSC Host handle
* @param id: MSC Host Library user message ID
* @retval None
*/
static void USBH_UserProcess2 (USBH_HandleTypeDef *phost, uint8_t id)
{
/* USER CODE BEGIN CALL_BACK_21 */
switch(id)
{
case HOST_USER_SELECT_CONFIGURATION:
break;
case HOST_USER_DISCONNECTION:
osMessagePut(AppliEvent, MSC_APPLICATION_DISCONNECT, 0);
if (FATFS_UnLinkDriver(USBDISKPath) == 0)
{
}
break;
break;
case HOST_USER_CONNECTION:
osMessagePut(AppliEvent, MSC_APPLICATION_READY, 0);
break;
case HOST_USER_CLASS_ACTIVE:
//Appli_state_MSC = MSC_APPLICATION_READY;
osMessagePut(AppliEvent, MSC_APPLICATION_READY, 0);
if (FATFS_LinkDriver(&USBH_Driver, USBDISKPath) == 0)
{
if (f_mount(&USBH_fatfs, "", 0) != FR_OK)
{
// LCD_ErrLog("ERROR : Cannot Initialize FatFs! \n");
}
else
{
MSC_Connected =1;
}
}
break;
default:
break;
}
/* USER CODE END CALL_BACK_21 */
}
2019-08-25 07:34 PM
I tried to do the similar thing on STm32F746 discovery board but not successes. I cannot find the TCP echo code with the LAN8742A ethernet chip. Does it mean I have to use DP83848 ethernet chip to get the TCP echo server function?
Thanks
2019-08-25 07:35 PM
Sorry, I am talking the TCP echo server with FreeRTOS.