Skip to content

Commit

Permalink
mpfs/version: add DIE type and speed grade to FPGA version string
Browse files Browse the repository at this point in the history
Signed-off-by: Tero Salminen <[email protected]>
  • Loading branch information
t-salminen committed May 29, 2024
1 parent df811b9 commit 7e0a82c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion msg/SystemVersionString.msg
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ char[32] hw_version # main autopilot hw version
char[32] sw_version # main autopilot sw version
char[32] os_version # OS or middleware version
char[32] bl_version # bootloader version
char[32] component_version1 # vendor specific component version
char[64] component_version1 # vendor specific component version
char[32] component_version2 # vendor specific component version
17 changes: 15 additions & 2 deletions platforms/nuttx/src/px4/microchip/mpfs/version/board_mcu_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
#define HW_INFO_FPGA_SUFFIX "%u.%u"

#define FPGA_VER_REGISTER 0x42000000
#define FPGA_DIE_TYPE_REGISTER 0x42000004
#define FPGA_SPEED_GRADE_REGISTER 0x42000008
#define MPFS_SYS_SERVICE_CR 0x37020050
#define MPFS_SYS_SERVICE_SR 0x37020054
#define MPFS_SYS_SERVICE_MAILBOX 0x37020800
Expand Down Expand Up @@ -281,12 +283,15 @@ int board_determine_hw_info(void)
struct system_version_s ver;
struct guid_s guid;
struct hw_info_s hwinfo;
char die_type_str[16];
orb_advert_t ver_str_pub = orb_advertise(ORB_ID(system_version_string), NULL);
orb_advert_t ver_pub = orb_advertise(ORB_ID(system_version), NULL);
orb_advert_t mfguid_pub = orb_advertise(ORB_ID(guid), NULL);
orb_advert_t hw_info_pub = orb_advertise(ORB_ID(hw_info), NULL);

uint32_t fpga_version = getreg32(FPGA_VER_REGISTER); // todo: replace eventually with device_boot_info
uint32_t fpga_die_type = getreg32(FPGA_DIE_TYPE_REGISTER);
uint32_t fpga_speed_grade = getreg32(FPGA_SPEED_GRADE_REGISTER);
uint64_t timestamp = hrt_absolute_time();

memset(&ver_str, 0, sizeof(ver_str));
Expand Down Expand Up @@ -324,11 +329,19 @@ int board_determine_hw_info(void)
strncpy(ver_str.bl_version, device_boot_info.bl_version, sizeof(ver_str.bl_version));
ver.bl_version = parse_tag_to_version(device_boot_info.bl_version);

/* FPGA DIE type/size (e.g. 95/160/250) */
if (fpga_die_type == 0) {
snprintf(die_type_str, sizeof(die_type_str), "Unknown DIE");
} else {
snprintf(die_type_str, sizeof(die_type_str), "MPFS%03d (SG %d)",
fpga_die_type, fpga_speed_grade);
}

/* FPGA version */

snprintf(fpga_info, sizeof(fpga_info),
HW_INFO_FPGA_PREFIX HW_INFO_FPGA_SUFFIX " (0x%04x)", fpga_version_major, fpga_version_minor,
getreg32(FPGA_VER_REGISTER));
HW_INFO_FPGA_PREFIX HW_INFO_FPGA_SUFFIX " (0x%04x), %s", fpga_version_major, fpga_version_minor,
fpga_version, die_type_str);
strncpy(ver_str.component_version1, fpga_info, min(sizeof(ver_str.component_version1), sizeof(fpga_info)));
ver.component_version1 = fpga_version;

Expand Down

0 comments on commit 7e0a82c

Please sign in to comment.