Add STM device resvision to MOTD.

This commit is contained in:
Mario Hüttel 2021-10-15 22:06:30 +02:00
parent d9c145ec81
commit 4009a2794d
6 changed files with 25 additions and 7 deletions

View File

@ -29,6 +29,8 @@
* @param mid mid word of ID * @param mid mid word of ID
* @param low low word of ID * @param low low word of ID
*/ */
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low); void stm_unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low);
void stm_dev_rev_id_get(uint32_t *device_id, uint32_t *revision_id);
#endif /* __UNIQUE_ID_H__ */ #endif /* __UNIQUE_ID_H__ */

View File

@ -34,7 +34,7 @@
#include <reflow-controller/hw-version-detect.h> #include <reflow-controller/hw-version-detect.h>
/** /**
* @brief PID ontroller instance of the oven driver * @brief PID controller instance of the oven driver
*/ */
static struct pid_controller IN_SECTION(.ccm.bss) oven_pid; static struct pid_controller IN_SECTION(.ccm.bss) oven_pid;

View File

@ -38,7 +38,7 @@ static void get_controller_folder_path(char *path, size_t size)
if (!path) if (!path)
return; return;
unique_id_get(&high, &mid, &low); stm_unique_id_get(&high, &mid, &low);
snprintf(path, size, "/%08X-%08X-%08X", snprintf(path, size, "/%08X-%08X-%08X",
(unsigned int)high, (unsigned int)mid, (unsigned int)low); (unsigned int)high, (unsigned int)mid, (unsigned int)low);

View File

@ -64,10 +64,13 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
uint32_t low_id; uint32_t low_id;
uint32_t mid_id; uint32_t mid_id;
uint32_t high_id; uint32_t high_id;
uint32_t stm_rev_id;
uint32_t stm_dev_id;
const char *hw_rev_str; const char *hw_rev_str;
enum hw_revision pcb_rev; enum hw_revision pcb_rev;
unique_id_get(&high_id, &mid_id, &low_id); stm_unique_id_get(&high_id, &mid_id, &low_id);
stm_dev_rev_id_get(&stm_dev_id, &stm_rev_id);
shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n" shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n"
"Compiled: " __DATE__ " at " __TIME__ "\r\n"); "Compiled: " __DATE__ " at " __TIME__ "\r\n");
@ -85,7 +88,10 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
hw_rev_str = "Hardware: Unknown Revision. You might have to update the firmware!"; hw_rev_str = "Hardware: Unknown Revision. You might have to update the firmware!";
break; break;
} }
shellmatta_printf(handle, "%s", hw_rev_str); shellmatta_printf(handle, "%s\r\n", hw_rev_str);
shellmatta_printf(handle, "STM Device ID: 0x%04X\r\n", stm_dev_id);
shellmatta_printf(handle, "STM Revision ID: 0x%04X\r\n", stm_rev_id);
return SHELLMATTA_OK; return SHELLMATTA_OK;
} }

View File

@ -19,12 +19,13 @@
*/ */
#include <stm-periph/unique-id.h> #include <stm-periph/unique-id.h>
#include <stm32/stm32f4xx.h>
#define LOW_WORD_ADDR (0x1FFF7A10UL) #define LOW_WORD_ADDR (0x1FFF7A10UL)
#define MID_WORD_ADDR (LOW_WORD_ADDR+4U) #define MID_WORD_ADDR (LOW_WORD_ADDR+4U)
#define HIGH_WORD_ADDR (LOW_WORD_ADDR+8U) #define HIGH_WORD_ADDR (LOW_WORD_ADDR+8U)
void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low) void stm_unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low)
{ {
if (!high || !mid || !low) if (!high || !mid || !low)
return; return;
@ -33,3 +34,12 @@ void unique_id_get(uint32_t *high, uint32_t *mid, uint32_t *low)
*mid = *((uint32_t *)MID_WORD_ADDR); *mid = *((uint32_t *)MID_WORD_ADDR);
*high = *((uint32_t *)HIGH_WORD_ADDR); *high = *((uint32_t *)HIGH_WORD_ADDR);
} }
void stm_dev_rev_id_get(uint32_t *device_id, uint32_t *revision_id)
{
if (device_id)
*device_id = DBGMCU->IDCODE & DBGMCU_IDCODE_DEV_ID;
if (revision_id)
*revision_id = (DBGMCU->IDCODE & DBGMCU_IDCODE_REV_ID) >> 16;
}

View File

@ -189,7 +189,7 @@ static void gui_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry ent
if (last_page == 3) if (last_page == 3)
break; break;
last_page = 3; last_page = 3;
unique_id_get(&ser1, &ser2, &ser3); stm_unique_id_get(&ser1, &ser2, &ser3);
menu_lcd_outputf(menu, 0, "Serial: %08X", ser1); menu_lcd_outputf(menu, 0, "Serial: %08X", ser1);
menu_lcd_outputf(menu, 1, " %08X", ser2); menu_lcd_outputf(menu, 1, " %08X", ser2);