Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Solved

Solved already :-)

[As an aside, the CDC_Transmit_FS requires a check before being called:

char msg100;

sprintf(msg,”ARM reporting %i\n”)i++);
if (hUsbDeviceFS.dev_state == USBD_STATE_CONFIGURED)
CDC_Transmit_FS((uint8_t *)msg, strlen(msg));
]

And then static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len) is a callback function
defined in usbd_cdc_if.c which gets called whenever there is data arriving
in USB through the virtual com port.

I modified the function to add 3 lines of code to copy out the incoming buffered data like this:

static int8_t CDC_Receive_FS (uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf0);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);

// This function CDC_Receive_FS is a callback function invoked when data is received - add 3 extra lines of code to copy the data to my own buffer
received_data_size = *Len;
memcpy(received_data, Buf, received_data_size);
receive_total += received_data_size;

return (USBD_OK);
/* USER CODE END 6 */
}

Further up the file usbd_cdc_if.c, I modified the data sizes and declared the 3 variables I am using

//#define APP_RX_DATA_SIZE 4
//#define APP_TX_DATA_SIZE 4

  1. define APP_RX_DATA_SIZE 64
  2. define APP_TX_DATA_SIZE 64

uint8_t received_data100;
uint32_t received_data_size;
uint32_t receive_total = 0;

in file usbd_cdc_if.h, I added 3 lines to export the three variables I am using:

extern uint8_t received_data[];
extern uint32_t received_data_size;
extern uint32_t receive_total;

In main.c I added #include “usbd_cdc_if.h”
and then printed out the receive_total and also the received_data.

It turns out the data is now received in blocks of 64 bytes
as decide in usbd_cdc_if.c by

  1. define APP_RX_DATA_SIZE 64
  2. define APP_TX_DATA_SIZE 64


Yippeee it works from CubeMX generated code compiled in AC6 with SW4STM32 toolchain :-)