I was trying to set up FOC with TMC9660 with feedback from an absolute encoder through SPI. I was using the TMC9660-STP-EVKIT with TMCL IDE. Here are the steps that I took
- Create a new .toml configuration file, upload my custom config with that file, and attached is what "Load config from chip" gave back after uploading
-
################################################################################ # Boot configuration # Generated by UblTools v1.0.1 for boot config v1.0 ################################################################################ io_config_version = "v1.0" [ldo] vext1_voltage = 5.0 # 0.0, 2.5, 3.3, 5.0 vext1_slope_speed = 3.0 # 3.0, 1.5, 0.75, 0.37 vext2_voltage = 3.3 # 0.0, 2.5, 3.3, 5.0 vext2_slope_speed = 3.0 # 3.0, 1.5, 0.75, 0.37 fault_on_short = false [bootstrap] disable_selftest = false fault_on_bl_ready = false load_rom_code = false fault_on_config = false fault_on_launch = false [app_settings] app_type = "param" # "param", "reg" [uart] enabled = true pin_ic_tx = 6 # 6, 0 pin_ic_rx = 7 # 7, 1 baud_rate = "auto16" # 9600, 19200, 38400, 57600, 115200, 1000000, "auto8", "auto16" chip_address = 1 # 0 - 255 host_address = 255 # 0 - 255 #pin_ic_txen = 2 # 2, 8 (optional) txen_pre_delay = 0 # 0 - 255 (Required if pin_ic_txen is set) txen_post_delay = 0 # 0 - 255 (Required if pin_ic_txen is set) [spi_slave] enabled = false spi_block = "SPI0" # "SPI0", "SPI1" pin_spi0_sck = 11 # 6, 11 (Required when spi_block = "SPI0") [hall] enabled = false pin_u = 2 # 2, 7, 9 pin_v = 3 # 3, 15 pin_w = 4 # 4, 8, 10 [abn1] enabled = false pin_a = 5 # 5, 8, 17 pin_b = 1 # 1, 13, 18 #pin_n = 14 # 14, 16 (optional) [spi_flash] enabled = false spi_block = "SPI1" # "SPI0", "SPI1" pin_cs = 0 # 0 - 18 pin_spi0_sck = 11 # 6, 11 (Required when spi_block = "SPI0") frequency = 10000000 # Hz : 40 MHz / (N+1), N: 3-15 [i2c_eeprom] enabled = false pin_scl = 4 # 4, 12, 13 pin_sda = 5 # 5, 11, 14 address = 0 # 0 - 7 frequency = 100000 # Hz : 100000 * 2^N, N: 0-5 [ext_mem] #tmcl_script = "spi-flash" # "spi-flash", "i2c-eeprom" (optional) #parameter_storage = "spi-flash" # "spi-flash", "i2c-eeprom" (optional) [ref_switch] pin_left = 2 # 2, 12, 16 (optional) pin_home = 4 # 4, 7, 15, 17 (optional) pin_right = 3 # 3, 18 (optional) [step_dir] enabled = false pin_step = 7 # 7, 11, 16 pin_dir = 6 # 6, 15 [abn2] enabled = false pin_a = 6 # 6, 15 pin_b = 7 # 7, 11, 16 [watchdog] enabled = true timeout = 2000 # 250, 500, 750, 1000, 1250, 1500, 1750, 2000 [brakechopper] enabled = false pin_brakechopper = 0 # 0-18, "Y2" [mechanical_brake] enabled = false pin_mech_brake = 3 # 3, 10, 18, "Y2" [spi_encoder] enabled = true spi_block = "SPI0" # "SPI0", "SPI1" spi_mode = 1 # 0 - 3 frequency = 4000000 # Hz : 40MHz / (N+4), N: 0-15 pin_spi0_sck = 11 # 6, 11 (Required when spi_block = "SPI0") pin_cs = 12 # 12, 13, 16 for spi_block="SPI0", 15 for spi_block="SPI1" [gpio0] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pulldown" # "disabled", "pulldown", "pullup" (optional) [gpio1] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pulldown" # "disabled", "pulldown", "pullup" (optional) [gpio2] type = "input" # "input", "output", "analog" (optional) #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "disabled" # "disabled", "pulldown", "pullup" (optional) [gpio3] type = "input" # "input", "output", "analog" (optional) #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "disabled" # "disabled", "pulldown", "pullup" (optional) [gpio4] type = "input" # "input", "output", "analog" (optional) #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "disabled" # "disabled", "pulldown", "pullup" (optional) [gpio5] type = "input" # "input", "output", "analog" (optional) #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "disabled" # "disabled", "pulldown", "pullup" (optional) [gpio6] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio7] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio8] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio9] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio10] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio11] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio12] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio13] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio14] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio15] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio16] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio17] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [gpio18] type = "input" # "input", "output (optional)" #output_value = 0 # 0, 1 (Required when type="output") pull_resistor = "pullup" # "disabled", "pulldown", "pullup" (optional) [pll] enabled = true source = "ExtOsc" # "IntOsc", "ExtOsc", "ExtClk" ext_frequency = 16000000 # Frequency of the external oscillator or external clock in Hz. # Multiple of 1MHz when source="ExtClk". # 8MHz, 16MHz, 24MHz or 32MHz when source="ExtOsc" xtal_boost = false # Use maximum current on Oscillator startup. Required when source="ExtOsc" sys_frequency = 40000000 # Hz: 15000000, 40000000. The motor control system requires the system run at 40 MHz. - Start in app in Parameter Mode
- On TMC9660 Direct Mode window I do the following
- Set axis parameter of 183-SPI_ENCODER_MAIN_TRANSFER_CMD_SIZE with 2
- Set axis parameter of 185-SPI_ENCODER_TRANSFER_DATA_3_0 with 0xFFFE (65534)
- Set axis parameter of 189-SPI_ENCODER_TRANSFER to 1
- With that last step, according to the datasheet, I should be seeing a frame on SPI0. But with an oscilloscope, I did not see any change in any of clock signals on J205, which should be the header for TMC9660's SPI0.
- Note that there is nothing externally connected to this header yet, and the only thing thats on the SPI bus should be the SPI Flash on the eval board and landungsbruecke board.
To verify that the SPI pin is not broken, with default eval board config, I was able to see signals on J205 when doing Inspect Partition.
I also try the exact steps with another TMC9660 eval board, and still no signals on J205 SPI
I also tried setting these before initiating a single transfer (189-SPI_ENCODER_TRANSFER to 1)
- 190-SPI_ENCODER_POSITION_COUNTER_MASK to 0xFFFF
- 195-SPI_ENCODER_DIRECTION to 1 and back 0 (due to errata)
Which didint affect anything, still no signals on J205
Is there anything I missed while setting up for this?
Edit Notes
grammatical error[edited by: Cade at 11:37 AM (GMT -4) on 9 Oct 2025]