Nucleo-144 STM32F767. Example USB-MSC-Device doesn't connect to PC correctly.
Hi, colleges!
I use Nucleo-144 STm32F767 development board to learn USB.
Now - Application example - device USB MSC.
The example uses SD card, with I haven't. I want to use internal instead of SD card. So, I changed the "usbd_storage.c" file. Plugged and not played =) Error - Cann't start this device (code 10).
My STM32 is falling in HardFault_Handler. I've put break point in "Handle Enumeration done Interrupt" and seen the process has stopped. The enumeration process is done. Ok.
What is going then? Which step is next? Where I need to put my break point?
I don't really know how to debug USB transaction and communication process. Wireshark doesn't see my device at all.
/* Private variables ---------------------------------------------------------*/
uint8_t usbMassStorage[0x1000];
....
int8_t STORAGE_GetCapacity(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
{
*block_num = sizeof(usbMassStorage)/512;
*block_size = 512;
return 0;
}
int8_t STORAGE_IsReady(uint8_t lun)
{
return 0;
}
int8_t STORAGE_IsWriteProtected(uint8_t lun)
{
return 0;
}
int8_t STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
memcpy(buf,&usbMassStorage[blk_addr],blk_len);
return 0;
}
int8_t STORAGE_Write(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
{
memcpy(&usbMassStorage[blk_addr],buf,blk_len);
return 0;
}
int8_t STORAGE_GetMaxLun(void)
{
return(STORAGE_LUN_NBR - 1);
}