Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ext id hash #322

Merged
merged 23 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![Docs Build](https://github.com/yconst/tinymovr/workflows/Tinymovr%20Docs%20Build/badge.svg)
[![Discord](https://img.shields.io/discord/742400176664084535)](https://discord.gg/CzcCaXbU)

[Tinymovr is an affordable motor controller](https://tinymovr.com) for precise control of 3-phase brushless motors. Tinymovr works with up to 38V input voltage, drives motors up to 40A continuous phase current, integrates an absolute angle encoder (MPS MA702) and features rich connectivity.
[Tinymovr is an affordable motor controller](https://tinymovr.com) with integrated encoder and CAN bus for precise control of 3-phase brushless motors (PMSMs).

This repository holds the open source firmware, client library, hardware designs and documentation source.

Expand Down
8 changes: 4 additions & 4 deletions docs/hardware/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ M5.x

Tinymovr M5.x is is our specialized driver for gimbal motors and light robotic joints. It features a very compact footprint and 5A max drive.

Board Dimensions (M5.1)
#######################
Board Dimensions (M5.1, M5.2)
#############################

.. image:: dimensions_m5.png
:width: 800
:alt: Tinymovr M5 dimensions

Connectivity (M5.1)
###################
Connectivity (M5.1, M5.2)
#########################

.. image:: connectors_m5.png
:width: 800
Expand Down
10 changes: 6 additions & 4 deletions docs/studio/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ In order for multiple Tinymovr instances to coexist in the same CAN network, the
:width: 400
:alt: Change CAN bus node ID using the GUI

The board will be discovered with the new ID. Studio GUI will rescan, discover the new node, and remove the old instance.

2. |cli| Change the ID

.. code-block:: python
Expand All @@ -128,21 +130,21 @@ In order for multiple Tinymovr instances to coexist in the same CAN network, the

where x is the desired ID. You can assign IDs in the range 1-1024.

3. Relaunch Studio. The board will be discovered with the new ID.
The board will be discovered with the new ID. Relaunch Studio CLI to remove the old board instance.

4. |gui| Save configuration.
3. |gui| Save configuration.

.. image:: save_config.png
:width: 400
:alt: Save configuration using the GUI

4. |cli| Save configuration.
3. |cli| Save configuration.

.. code-block:: python

tm1.save_config()

5. Power down or reset the board. Tinymovr is now ready to use with the new ID.
4. Power down or reset the board. Tinymovr is now ready to use with the new ID.

.. _command-line-options:

Expand Down
4 changes: 2 additions & 2 deletions docs/upgrade/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ R5.0, R5.1
:width: 800
:alt: Tinymovr R5.0 and R5.1 connectors and pinouts

M5.1
====
M5.1, M5.2
==========

.. image:: connectors_m5.png
:width: 800
Expand Down
17 changes: 9 additions & 8 deletions firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ all: release
debug: CFLAGS += -DDEBUG -g2 -O1
debug: CPPFLAGS += -DDEBUG -g2 -O1
debug: LDFLAGS += -O1
debug: OBJECTS += $(BUILDDIR)/bootloader_$(REV).o
debug: OBJECTS += $(BUILDDIR)/bootloader-$(REV).o
debug: binary

# Upgrade target
Expand All @@ -114,11 +114,11 @@ upgrade: LDFLAGS += -O3
upgrade: binary

# Release target
release: OBJECTS += $(BUILDDIR)/bootloader_$(REV).o
release: OBJECTS += $(BUILDDIR)/bootloader-$(REV).o
release: upgrade

# Binary target
binary: print_board_rev $(HEX) $(BIN) $(ELF)
binary: print_board_info $(HEX) $(BIN) $(ELF)

# Objcopy to HEX
$(HEX): $(ELF)
Expand All @@ -131,7 +131,7 @@ $(BIN): $(ELF)

# Link
$(ELF): $(OBJECTS)
- $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.bl_section,alloc,load,readonly,data,contents $(PROJECTDIR)/bootloader/bootloader_$(REV).bin $(BUILDDIR)/bootloader_$(REV).o
- $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.bl_section,alloc,load,readonly,data,contents $(PROJECTDIR)/bootloader/bootloader-$(REV).bin $(BUILDDIR)/bootloader-$(REV).o
$(LD) $(LDFLAGS) $(OBJECTS) -o $(ELF)
$(SIZE_EX) --format=berkeley $(ELF)

Expand All @@ -151,8 +151,9 @@ clean :
- $(rmdir_cmd) "$(BUILDDIR)"

# Print board revision
.PHONY: print_board_rev
print_board_rev:
@echo "===Building Tinymovr==="
.PHONY: print_board_info
print_board_info:
@echo "===Building Tinymovr Bootloader==="
@echo "Board revision is $(REV)"
@echo "======================="
@echo "Fw version is $(GIT_VERSION)"
@echo "=================================="
Binary file added firmware/bootloader/bootloader-M51.bin
Binary file not shown.
Binary file added firmware/bootloader/bootloader-R32.bin
Binary file not shown.
Binary file added firmware/bootloader/bootloader-R33.bin
Binary file not shown.
Binary file added firmware/bootloader/bootloader-R50.bin
Binary file not shown.
Binary file added firmware/bootloader/bootloader-R51.bin
Binary file not shown.
Binary file added firmware/bootloader/bootloader-R52.bin
Binary file not shown.
Binary file removed firmware/bootloader/bootloader_M51.bin
Binary file not shown.
Binary file removed firmware/bootloader/bootloader_R32.bin
Binary file not shown.
Binary file removed firmware/bootloader/bootloader_R33.bin
Binary file not shown.
Binary file removed firmware/bootloader/bootloader_R50.bin
Binary file not shown.
Binary file removed firmware/bootloader/bootloader_R51.bin
Binary file not shown.
Binary file removed firmware/bootloader/bootloader_R52.bin
Binary file not shown.
6 changes: 5 additions & 1 deletion firmware/src/can/can.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ static CANState state ={0};

extern volatile uint32_t msTicks;

const uint8_t avlos_proto_hash_8 = (uint8_t)(avlos_proto_hash & 0xFF);
const size_t endpoint_count = sizeof(avlos_endpoints) / sizeof(avlos_endpoints[0]);

void CAN_init(void)
{
#if defined(BOARD_REV_R52)
Expand Down Expand Up @@ -135,7 +138,8 @@ void CAN_process_interrupt(void)
{
can_process_extended();

if (sizeof(avlos_endpoints) / sizeof(avlos_endpoints[0]) > can_ep_id)
if ((endpoint_count > can_ep_id) &&
((can_frame_hash == avlos_proto_hash_8) || (can_frame_hash == 0)))
{
uint8_t (*callback)(uint8_t buffer[], uint8_t * buffer_length, Avlos_Command cmd) = avlos_endpoints[can_ep_id];
uint8_t can_msg_buffer[8];
Expand Down
1 change: 0 additions & 1 deletion firmware/src/can/can_endpoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


uint8_t (*avlos_endpoints[79])(uint8_t * buffer, uint8_t * buffer_len, Avlos_Command cmd) = {&avlos_protocol_hash, &avlos_uid, &avlos_fw_version, &avlos_hw_revision, &avlos_Vbus, &avlos_Ibus, &avlos_power, &avlos_temp, &avlos_calibrated, &avlos_errors, &avlos_save_config, &avlos_erase_config, &avlos_reset, &avlos_enter_dfu, &avlos_scheduler_errors, &avlos_controller_state, &avlos_controller_mode, &avlos_controller_warnings, &avlos_controller_errors, &avlos_controller_position_setpoint, &avlos_controller_position_p_gain, &avlos_controller_velocity_setpoint, &avlos_controller_velocity_limit, &avlos_controller_velocity_p_gain, &avlos_controller_velocity_i_gain, &avlos_controller_velocity_deadband, &avlos_controller_velocity_increment, &avlos_controller_current_Iq_setpoint, &avlos_controller_current_Id_setpoint, &avlos_controller_current_Iq_limit, &avlos_controller_current_Iq_estimate, &avlos_controller_current_bandwidth, &avlos_controller_current_Iq_p_gain, &avlos_controller_current_max_Ibus_regen, &avlos_controller_current_max_Ibrake, &avlos_controller_voltage_Vq_setpoint, &avlos_controller_calibrate, &avlos_controller_idle, &avlos_controller_position_mode, &avlos_controller_velocity_mode, &avlos_controller_current_mode, &avlos_controller_set_pos_vel_setpoints, &avlos_comms_can_rate, &avlos_comms_can_id, &avlos_motor_R, &avlos_motor_L, &avlos_motor_pole_pairs, &avlos_motor_type, &avlos_motor_offset, &avlos_motor_direction, &avlos_motor_calibrated, &avlos_motor_I_cal, &avlos_motor_errors, &avlos_encoder_position_estimate, &avlos_encoder_velocity_estimate, &avlos_encoder_type, &avlos_encoder_bandwidth, &avlos_encoder_calibrated, &avlos_encoder_errors, &avlos_traj_planner_max_accel, &avlos_traj_planner_max_decel, &avlos_traj_planner_max_vel, &avlos_traj_planner_t_accel, &avlos_traj_planner_t_decel, &avlos_traj_planner_t_total, &avlos_traj_planner_move_to, &avlos_traj_planner_move_to_tlimit, &avlos_traj_planner_errors, &avlos_homing_velocity, &avlos_homing_max_homing_t, &avlos_homing_retract_dist, &avlos_homing_warnings, &avlos_homing_stall_detect_velocity, &avlos_homing_stall_detect_delta_pos, &avlos_homing_stall_detect_t, &avlos_homing_home, &avlos_watchdog_enabled, &avlos_watchdog_triggered, &avlos_watchdog_timeout };
uint32_t avlos_proto_hash = 3526126264;

uint32_t _avlos_get_proto_hash(void)
{
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/can/can_endpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef enum
ENCODER_TYPE_HALL = 1
} encoder_type_options;

extern uint32_t avlos_proto_hash;
static const uint32_t avlos_proto_hash = 3526126264;
extern uint8_t (*avlos_endpoints[79])(uint8_t * buffer, uint8_t * buffer_len, Avlos_Command cmd);
extern uint32_t _avlos_get_proto_hash(void);

Expand Down
Loading
Loading