Hello,
we are using the freertos_message_buffer from the example provided in the sdk on a imxrt1176 device.
We extended the memory to send and receive blocks with a length of 1024bytes. So our config looks like this:
#define APP_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE + 100)
#define APP_READY_EVENT_DATA (1U)
#define APP_MESSAGE_BUFFER_EVENT_DATA (1U)
#define APP_MAX_MESSAGE_LENGTH (0x400U)
#define APP_MESSAGE_BUFFER_SIZE (0x800U)
#define APP_SH_MEM_PRIMARY_TO_SECONDARY_MB_OFFSET (0x0u)
#define APP_SH_MEM_SECONDARY_TO_PRIMARY_MB_OFFSET (0x4u)
#define APP_SH_MEM_PRIMARY_TO_SECONDARY_MB_STRUCT_OFFSET (0x50u)
#define APP_SH_MEM_SECONDARY_TO_PRIMARY_MB_STRUCT_OFFSET (0xA0u)
#define APP_SH_MEM_PRIMARY_TO_SECONDARY_BUF_STORAGE_OFFSET (0x100u)
#define APP_SH_MEM_SECONDARY_TO_PRIMARY_BUF_STORAGE_OFFSET (0x900u)
#define SH_MEM_TOTAL_SIZE (6144U)
It seems the cm7 core tries to notify a task on the cm4 core wich results in a bus-fault error. Normaly the cm7 core should not notify the task, becaouse in the xStreamBuffer struct the xTaskWaitingToSend pointer is NULL.
But if the sbRECEIVE_COMPLETE macro is called the xTaskGenericNotify() fuction is called with the task address from the cm4 task. This results in a BusFault Address Register (BFAR) valid flag.
The rpmsh_sh_mem is located at address 0x202c0000 and looks like this. Here i can see the address of the slave task (0x1FFF6394) which is wrong called from the cm7 in the xSecondaryToPrimaryMessageBufferStruct at address 0x202C0060.
From the call hirarchy the sbRECEIVE_COMPLETE Macro should not call xTaskNotify because the xStreamBuffers xTaskWaitingToReceive is NULL.
Has anyone an idea what is happening here?
Thank you,
Florian
Hi Jing,
we are using the message buffers in a bigger software that i can not share with you. The problem occures not immediately. The sofware is running for 10h with much traffic through the message buffer.
I now overwrote the sbRECEIVE_COMPLETE like the sbSEND_COMPLETED macro is overwritten. But i do nothing in the sbRECEIVE_COMPLETED macro function now. With this change the software is running well. But i would like to understand whats the reason for this behaviour.
Thanks,
Florian
Hi @Flo1989 ,
Sometimes busfault will not happened immediately after the wrong instruction.
Regards,
Jing
Hi @Flo1989 ,
I modified freertos_message_buffers_cm7 and freertos_message_buffers_cm4 project using your code. But I don't see any problem. What else do you modified?
Regards,
Jing