Example: 11-Open-AMP/vuart.py

# 本作品采用MIT许可证授权。
# Copyright (c) 2024 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# This example demonstrates the most basic use of Open-AMP to communicate between two cores
# on dual-core micro-controllers. To run this example, firmware for the secondary core is
# required. For testing purposes, demo firmware for the secondary core is provided here:
# https://github.com/iabdalkader/openamp_vuart
# 要配置和构建固件,请按照README文件中的说明操作。
#
# 请注意,在大多数微控制器上,无法在不进行完全复位的情况下重置次级核心,
# 因此运行然后停止此脚本可能会导致开发板完全复位,
# 这完全正常。

import openamp
import time


def ept_recv_callback(src_addr, data):
    print("Received message: ", data.decode())


# 创建一个新的RPMsg端点以与M4通信。
ept = openamp.Endpoint("vuart-channel", callback=ept_recv_callback)

# 创建一个remoteproc对象,加载其固件并启动它。请注意,远程核心
# 如果闪存中存在固件(例如0x081E0000),也可以从闪存中的入口点启动。
# rproc = openamp.RProc(0x08180000)
rproc = openamp.RemoteProc("vuart.elf")
rproc.start()

count = 0
while True:
    if ept.is_ready():
        ept.send("Hello World %d!" % count, timeout=1000)
        count += 1
    time.sleep_ms(1000)

results matching ""

    No results matching ""