2025-04-16 7:14 AM - last edited on 2025-04-16 8:33 AM by mƎALLEm
Software: CUBEIDE:1.18.0
Firmware: STM32Cube_FW_H7_V1.12.1
Board: NUCLEO-H745ZI-Q
The problem is as follows: when using this chip for dual core communication, reproducing according to the example given by ST, communication cannot be carried out no matter what.
Through debugging, it was found that the problem lies in the OPENAMP_create_endpoint() function in the M4 core. The return value is -2005, but as a beginner, I am unable to pinpoint where the problem lies. I will attach my project at the end of the article.
My original goal was for the M7 core to send data to the M4 core, which would then print the data while the M7 core's LED would flash.
I have reviewed the corresponding routines in ST's AN5617 and firmware, and watched the corresponding videos, but still cannot solve the problem. I request your help
Solved! Go to Solution.
2025-04-16 9:38 AM
Hello, it may be a problem with the software translation. I followed the steps in the article. I have compared the engineer's operation and found that he only made changes to the flash.ld file, but I was unable to run it successfully. I originally intended to leave a comment under that article, but it seems that the engineer doesn't pay much attention to the community, so I had to ask questions.
2025-04-18 8:09 AM
Hello, after several days of trying and using the same code, I found that CUBEIDE1.16.0 can communicate normally, but the latest version 1.18.0 cannot communicate normally, and the error code is RPMSG.BUUFFER-ERROR=-2005. I will provide the corresponding engineering file in my answer. Please check if there is also such an error on your device. If so, could you please submit this bug?
2025-04-18 8:17 AM - edited 2025-04-18 10:12 AM
Hello,
Thank you.
Could you please tell what each zip file corresponds to?
2025-04-18 8:26 AM
Hello, 745_AMP is configured using CUBEIDE1.16.0 and the code is running normally. AMP_745 is configured with CUBEIDE1.18.0 and the code runs abnormally. CUBEIDE 1.16.0 uses the firmware FW_1.11.0 of H7, while CUBEIDE 1.18.0 uses the latest firmware. After you successfully submit the bug, I will set the answer you successfully submitted as the best response. I will include my debugging information and error code at the end of the article.
static int rpmsg_virtio_send_offchannel_raw(struct rpmsg_device *rdev,
uint32_t src, uint32_t dst,
const void *data,
int size, int wait)
{
struct rpmsg_virtio_device *rvdev;
struct rpmsg_hdr rp_hdr;
void *buffer = NULL;
unsigned short idx;
int tick_count = 0;
unsigned long buff_len;
int status;
struct metal_io_region *io;
/* Get the associated remote device for channel. */
rvdev = metal_container_of(rdev, struct rpmsg_virtio_device, rdev);
status = rpmsg_virtio_get_status(rvdev);
/* Validate device state */
if (!(status & VIRTIO_CONFIG_STATUS_DRIVER_OK)) {
return RPMSG_ERR_DEV_STATE;
}
if (wait)
tick_count = RPMSG_TICK_COUNT / RPMSG_TICKS_PER_INTERVAL;
else
tick_count = 0;
while (1) {
int avail_size;
/* Lock the device to enable exclusive access to virtqueues */
metal_mutex_acquire(&rdev->lock);
avail_size = _rpmsg_virtio_get_buffer_size(rvdev);
if (size <= avail_size)
buffer = rpmsg_virtio_get_tx_buffer(rvdev, &buff_len,
&idx);
metal_mutex_release(&rdev->lock);
if (buffer || !tick_count)
break;
if (avail_size != 0)
return RPMSG_ERR_BUFF_SIZE;<-------The problem lies here
metal_sleep_usec(RPMSG_TICKS_PER_INTERVAL);
tick_count--;
}
if (!buffer)
return RPMSG_ERR_NO_BUFF;
/* Initialize RPMSG header. */
rp_hdr.dst = dst;
rp_hdr.src=src;
rp_hdr.len = size;
rp_hdr.reserved = 0;
/* Copy data to rpmsg buffer. */
io = rvdev->shbuf_io;
status = metal_io_block_write(io, metal_io_virt_to_offset(io, buffer),
&rp_hdr, sizeof(rp_hdr));
RPMSG_ASSERT(status == sizeof(rp_hdr), "failed to write header\n");
status = metal_io_block_write(io,
metal_io_virt_to_offset(io,
RPMSG_LOCATE_DATA(buffer)),
data, size);
RPMSG_ASSERT(status == size, "failed to write buffer\n");
metal_mutex_acquire(&rdev->lock);
/* Enqueue buffer on virtqueue. */
status = rpmsg_virtio_enqueue_buffer(rvdev, buffer, buff_len, idx);
RPMSG_ASSERT(status == VQUEUE_SUCCESS, "failed to enqueue buffer\n");
/* Let the other side know that there is a job to process. */
virtqueue_kick(rvdev->svq);
metal_mutex_release(&rdev->lock);
return size;
}
2025-04-18 8:47 AM
Hello,
Internal ticket 208133 has been submitted for analysis.
I suggest to not accept the solution until we provide at least a preliminary analysis.
Thank you for your contribution.
2025-04-18 8:50 AM
Okay, once you provide the preliminary analysis, I will proceed with the operation according to your instructions.
2025-04-21 2:08 AM - edited 2025-04-21 2:13 AM
Hello @MECHO ,
In fact the issue has been already reported in this post.
In fact in your non-working project, you have this warning:
<command-line>: warning: "RPMSG_BUFFER_SIZE" redefined
<command-line>: note: this is the location of the previous definition
So in conclusion:
You have two issues from the beginning:
- You didn't update the linker files to allocate memory for OpenAMP.
- An issue with the generated code with STM32CuebIDE 1.18.0 (a regression from older versions)