Professional Documents
Culture Documents
Day 3 STM 32 MP 11645040882875
Day 3 STM 32 MP 11645040882875
STM32MP1 Primer
DAY 3 : STM32MP1 Interprocessor Communications
Sponsored by
Sponsored By
Webinar Logistics
2
Sponsored By
Fred Eady
Visit ‘Lecturer Profile’ in your console for more details.
3
STM32MP1 Primer
Sponsored By
AGENDA
IPCC Parts and Pieces
Coding an STM32MP157D IPCC Project
Coding an STM32MP157F IPCC Project
4
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Sponsored By
5
STM32MP1 Primer
STM32MP1 Interprocessor Communications
IPCC Parts and Pieces Sponsored By
&m4_rproc{
/*Restriction: "memory-region" property is not managed - please to use User-Section
if needed*/
mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
mbox-names = "vq0", "vq1", "shutdown";
status = "okay";
&ipcc{
status = "okay";
6
STM32MP1 Primer
STM32MP1 Interprocessor Communications
IPCC Parts and Pieces Sponsored By
MCUSRAM
RX and TX Vrings
Buffers
vdev0vring0:vdev0vring0@10040000{
compatible = "shared-dma-pool";
reg = <0x10040000 0x1000>;
no-map;
};
vdev0vring1:vdev0vring1@10041000{
compatible = "shared-dma-pool";
reg = <0x10041000 0x1000>;
no-map;
};
vdev0buffer:vdev0buffer@10042000{
compatible = "shared-dma-pool";
reg = <0x10042000 0x4000>;
no-map;
};
7
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157D IPCC Project Sponsored By
//****************************************************************
//* STM32MP157D IPCC
//* VERSION 1.00 A
//* COMPILED USING OpenSTLinux
//* WRITTEN BY FRED EADY
//* LAST UPDATED 01/31/2022
//* CHANGES/ADDITIONS
//****************************************************************
#include "main.h"
#include "openamp.h"
#include "virt_uart.h"
#include "gpio.h"
VIRT_UART_HandleTypeDef huart0;
IPCC_HandleTypeDef hipcc;
if(IS_ENGINEERING_BOOT_MODE())
{
/* Configure the system clock */
SystemClock_Config();
}
if(IS_ENGINEERING_BOOT_MODE())
{
/* Configure the peripherals common clocks */
PeriphCommonClock_Config();
}
else
{
__HAL_RCC_HSEM_CLK_ENABLE();
MX_IPCC_Init();
MX_OPENAMP_Init(RPMSG_REMOTE, NULL);
}
MX_GPIO_Init();
if (VIRT_UART_Init(&huart0) != VIRT_UART_OK)
{
Error_Handler();
}
//we need to register the callback for message reception by channels
if(VIRT_UART_RegisterCallback(&huart0, VIRT_UART_RXCPLT_CB_ID, VIRT_UART0_RxCpltCallback) != VIRT_UART_OK)
{
Error_Handler();
} 9
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157D IPCC Project Sponsored By
Operational Code
if (VirtUart0RxMsgStatus)
{
VirtUart0RxMsgStatus = RESET;
switch(VirtUart0ChannelRxBuf[0])
{
case 0x31:
HAL_GPIO_WritePin(LED7_ORG_GPIO_PORT,LED7_ORG_PIN,SET);
break;
case 0x30:
HAL_GPIO_WritePin(LED7_ORG_GPIO_PORT,LED7_ORG_PIN,RESET);
break;
}
}
if(counter++ == 500000)
{
HAL_GPIO_TogglePin(LED5_GRN_GPIO_PORT,LED5_GRN_PIN);
counter = 0;
}
}
10
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157D IPCC Project Sponsored By
11
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157D IPCC Project Sponsored By
12
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157F IPCC Project Sponsored By
//********************************************************
//* OPEN /dev/ttyRPMSG0
//********************************************************
void init(void)
{
sprintf(filename,"/dev/ttyRPMSG0");
fd_ipcc = open(filename,O_RDWR | O_NOCTTY | O_NONBLOCK);
if(fd_ipcc < 0)
{
puts("open /dev/ttyRPMSG0 failed\r\n");
exit(1);
}
else
{
puts("/dev/ttyRPMSG0 opened\r\n");
}
}
13
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157F IPCC Project Sponsored By
gtk_builder_connect_signals(builder, NULL);
gtk_widget_show(windowAccel);
g_timeout_add_seconds(1,(GSourceFunc)ipccTimer_handler, timer);
gtk_main();
return EXIT_SUCCESS; 14
}
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157F IPCC Project Sponsored By
15
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157F IPCC Project Sponsored By
if (VirtUart0RxMsgStatus)
{
VirtUart0RxMsgStatus = RESET;
switch(VirtUart0ChannelRxBuf[0])
{
case 0x31:
HAL_GPIO_WritePin(LED7_ORG_GPIO_PORT,LED7_ORG_PIN,SET);
break;
case 0x30:
HAL_GPIO_WritePin(LED7_ORG_GPIO_PORT,LED7_ORG_PIN,RESET);
break;
}
//send data to A7
if(scratch8++ == 0x39)
{
scratch8 = 0x30;
}
txBuf[0] = scratch8;
VIRT_UART_Transmit(&huart0,txBuf,1);
}
} 16
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157F IPCC Project Sponsored By
17
STM32MP1 Primer
STM32MP1 Interprocessor Communications
Coding an STM32MP157F IPCC Project Sponsored By
18
Sponsored By
MORE TO COME…
Thank you for attending!!!
To get today’s Project Download Package please send an email request to: therealfredeady@gmail.com
19
Thank You
Sponsored by