2020-11-02 02:02 AM
Hello,
I am using stm32l476, i am trying to run an AI validation project.
i replaced the UART with USB (CDC profile)
but, when trying to run "validation on target" from the CubeMX, i get this message ->
LOAD ERROR: STM32 - no connected board(s), invalid firmware or the board should be re-started.
i saw in my debugger that 5 messages received , but nothing was sent to host.
what do you think could be the problem?
Avi
2020-11-02 05:18 AM
Hello,
Before to investigate more the provided code (thanks for this), after a quick review, I have noted in the proposed implementation of the ioRawXXBuffer() functions, a potential issue in the ioRawReadBuffer() function. The function provides the address of the buffer which MUST be filled. In your implementation, the provided pointer is only updated (buff = &array[g_usbRxBuffIndex]). Can you replace this by a copy?
I have also noted, that the UART used through the ST-Link (VCP) is always configured. When you launch the validation, make sure that the correct COM (exposed by the USB.CDC profile) port is used and enumerated by the HOST.
br,
Jean-Michel
2020-11-03 12:34 AM
Hi Again,
Thanks for noticing this bug but i still have a problem.
it seems like 4 messages received and responded.
but still , i am getting a message "LOAD ERROR: STM32 - no connected board(s), invalid firmware or the board should be re-started"
Did I mised something? Or forgot to replace\change when moving from UART to USB (CDC profile)
Attached is my Project with screenshot of messages that ST receives from CubeMX.
Avi
2020-11-10 10:20 AM
Hello,
Sorry for the delay, but I wanted to have a set-up to test the USB CDC profile. I have used a STM32F76ZI Nucleo Board. The project has been generated with CubeMX 6.1 and X-CUBE-AI extension 5.2.
Attached file shows the main modifications + (see following snipped code)
/* usbd_cdc_if.h */
#define APP_RX_DATA_SIZE 64 // 2048
#define APP_TX_DATA_SIZE 64 // 2048
/* usbd_cdc_if.c */
static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length)
{
/* USER CODE BEGIN 5 */
switch(cmd)
...
case CDC_GET_LINE_CODING:
if (length == 7) {
*(uint32_t *)pbuf = 115200;
pbuf[4] = 0;
pbuf[5] = 0;
pbuf[6] = 8;
}
...
}
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
if (((Buf == NULL) || (Len == NULL)) || (*Len <= 0))
{
return USBD_FAIL;
}
extern void ioPushInUserUsb(uint8_t *pw, uint32_t *len);
ioPushInUserUsb(Buf, Len);
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
return (USBD_OK);
/* USER CODE END 6 */
}
/* aiValidation.c file modification */
/* 3 - Processing ------------------------------------------------ */
// ints = disableInts(); // line 579
...
// restoreInts(ints); // line 610
aiObserverUnbind(ctx);
With these modifications, I can use the USB CDC class to perform the validation, for example with the following CLI command.
$ stm32ai validate /c/ai_tests/_internal/keras/deepnet_relu.h5 --mode stm32 -d COM3
I hope this will help you with your set-up.
br,
Jean-Michel