Skip to content

Commit 3cae1e8

Browse files
committed
Added uid system command
1 parent 4ccc04f commit 3cae1e8

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
### Changes this version:
2-
- Added effect monitoring per axis
2+
- Added uid command (`sys.uid?` returns first 64 bits as val and second 32 as adr)
33

44
### Changes in 1.13.x
55
- Added PWM direction toggle
66
- Added basic iterative TMC PI autotuning
77
- Fixed issues with CAN transmission with multiple axes
88
- Added SSI encoder support (AMT232B)
99
- Fixed SPI buttons not working (SPI2 DMA on F407)
10-
- Dynamic TMC encoder alignment current based on current limit
10+
- Dynamic TMC encoder alignment current based on current limit
11+
- Added effect monitoring per axis
12+

Firmware/FFBoard/Inc/SystemCommands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "CommandHandler.h"
1212

1313
enum class FFBoardMain_commands : uint32_t{
14-
help=0,save=1,reboot=2,dfu=3,swver=4,hwtype=5,lsmain,main,lsactive,format,errors,errorsclr,flashdump,flashraw,vint,vext,mallinfo,heapfree,taskstats,debug,devid
14+
help=0,save=1,reboot=2,dfu=3,swver=4,hwtype=5,lsmain,main,lsactive,format,errors,errorsclr,flashdump,flashraw,vint,vext,mallinfo,heapfree,taskstats,debug,devid,uid
1515
};
1616

1717
class SystemCommands : public CommandHandler {

Firmware/FFBoard/Inc/constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* For more settings see target_constants.h in a target specific folder
99
*/
1010

11-
static const uint8_t SW_VERSION_INT[3] = {1,13,2}; // Version as array. 8 bit each!
11+
static const uint8_t SW_VERSION_INT[3] = {1,13,3}; // Version as array. 8 bit each!
1212
#define MAX_AXIS 2 // ONLY USE 2 for now else screws HID Reports
1313
#define FLASH_VERSION 0 // Counter to increase whenever a full flash erase is required.
1414

Firmware/FFBoard/Src/SystemCommands.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void SystemCommands::registerCommands(){
6868
CommandHandler::registerCommand("devid", FFBoardMain_commands::devid, "Get chip dev id and rev id",CMDFLAG_GET);
6969
CommandHandler::registerCommand("name", CommandHandlerCommands::name, "name of class",CMDFLAG_GET|CMDFLAG_STR_ONLY);
7070
CommandHandler::registerCommand("cmdinfo", CommandHandlerCommands::cmdinfo, "Flags of a command id (adr). -1 if cmd id invalid",CMDFLAG_GETADR);
71+
CommandHandler::registerCommand("uid", FFBoardMain_commands::uid, "Get 96b chip uid. Adr0-2 sel blk",CMDFLAG_GET | CMDFLAG_GETADR);
7172
}
7273

7374
// Choose lower optimize level because the compiler likes to blow up this function
@@ -265,6 +266,20 @@ CommandStatus SystemCommands::internalCommand(const ParsedCommand& cmd,std::vect
265266
HAL_FLASH_Lock();
266267
}
267268
break;
269+
case FFBoardMain_commands::uid:
270+
if(cmd.type == CMDtype::get){
271+
replies.emplace_back((uint64_t)HAL_GetUIDw0() | (uint64_t)HAL_GetUIDw1() << 32,HAL_GetUIDw2());
272+
}else if(cmd.type == CMDtype::getat){
273+
if(cmd.adr == 0){
274+
replies.emplace_back(HAL_GetUIDw0());
275+
}else if(cmd.adr == 1){
276+
replies.emplace_back(HAL_GetUIDw1());
277+
}else if(cmd.adr == 2){
278+
replies.emplace_back(HAL_GetUIDw2());
279+
}
280+
}
281+
break;
282+
268283

269284
default:
270285
flag = CommandStatus::NOT_FOUND;

0 commit comments

Comments
 (0)