2018-09-19 01:55 AM
When generating code for F7 MCU with HCD and full assert enabled CubeMX generates line in "stm32f7xx_hal_hcd.c":
assert_param(IS_HCD_ALL_INSTANCE(hhcd->Instance));
however IS_HCD_ALL_INSTANCE is not define anywhere, and linker gives error as expected:
STM32F746G_Discovery_test001\Debug/..\Drivers\STM32F7xx_HAL_Driver\Src/stm32f7xx_hal_hcd.c:134: undefined reference to `IS_HCD_ALL_INSTANCE'
I've checked it with STM32F767 and STM32F746 MCUs and CubeMX 4.27.0 and previous as well.
best regards
Mikolaj Tutak
2018-10-02 02:54 AM
It sems a bug in STM32CubeMX, I hit the same problem for IS_HCD_ALL_INSTANCE and IS_PCD_ALL_INSTANCE.
Drivers\STM32F7xx_HAL_Driver\stm32f7xx_hal_hcd.o: In function `HAL_HCD_Init':
..\..\..\Drivers\STM32F7xx_HAL_Driver\Src/stm32f7xx_hal_hcd.c:134: undefined reference to `IS_HCD_ALL_INSTANCE'
Drivers\STM32F7xx_HAL_Driver\stm32f7xx_hal_pcd.o: In function `HAL_PCD_Init':
..\..\..\Drivers\STM32F7xx_HAL_Driver\Src/stm32f7xx_hal_pcd.c:154: undefined reference to `IS_PCD_ALL_INSTANCE'
To solve it, I inserted the next lines in Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32fnnnxx.h (please substitute nnn for your MCU)
/*********************** PCD Instances ****************************************/
#define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS) || \
((INSTANCE) == USB_OTG_HS))
/*********************** HCD Instances ****************************************/
#define IS_HCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS) || \
((INSTANCE) == USB_OTG_HS))
2018-10-09 06:40 AM
Hello,
Thanks for reporting this issue, already faced by some other users as reported in https://community.st.com/s/question/0D50X00009ZDOSgSAP/stm32cubefwf7v1120-may-have-a-bug.
This is tracked internally and should be fixed in coming releases.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2018-11-20 12:45 PM
Still not solved in STM32Cube_FW_F7_V1.13.0. Also, depending on the data transferred over usb in a custom hid device, the functions USB_WritePacket and USB_ReadPacket in file stm32f7xx_ll_usb.c can cause a hard fault (unaligned). I get a workaround using the solution proposed by Jack (thanks) and rewritten the functions using the old code from STM32Cube_FW_F7_V1.11.0:
HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t count32b= 0 , i= 0;
if (dma == 0)
{
count32b = (len + 3) / 4;
for (i = 0; i < count32b; i++, src += 4)
{
USBx_DFIFO(ch_ep_num) = *((__packed uint32_t *)src);
}
}
return HAL_OK;
}
--------------------------------------------------------------
void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len)
{
uint32_t USBx_BASE = (uint32_t)USBx;
uint32_t i=0;
uint32_t count32b = (len + 3) / 4;
for ( i = 0; i < count32b; i++, dest += 4 )
{
*(__packed uint32_t *)dest = USBx_DFIFO(0);
}
return ((void *)dest);
}
2018-11-22 02:19 AM
Hello @Community member ,
I confirm that the initially described issue isn't yet fixed; we should wait for the new USB library to embedded in the STM32Cube packages that will apply the fix.
Regarding the second issue you described in your post, could you please create a separate dedicated question to track it?
Thanks for your understanding.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.