I burned six B-G431-ESC

  1. Please ensure you can run the setup in open loop mode.
  2. You say your motor is 36V but inside your code you set

driver.voltage_power_supply = 20;

What voltage you supply to the ESC?

  1. Running in open-loop, assuming you really use 20V, please start with

motor.voltage_limit = 2.0;

This will ensure you are well protected and have plenty of headroom.

Also, you MUST heavily cool the ESC. This ESC is notorious for extremely poor heat dissipation design and management and requires very good air current flow and a heatsink.

  1. Once you have your open velocity running and are happy with the setup, you can slowly progress to closed loop. Skip current sense and run voltage closed loop with the encoder. Once this is OK, you can evolve to current sensing.

Generally this ESC is not suitable for SimpleFOC unless you are very experienced, take extreme precautions for cooling and take your time and have a lot of patience experimenting.

Cheers,
Valentine

PS Check this thread with my comments below

https://community.simplefoc.com/t/b-g431b-esc1-beginner-guide-i2c-guide/515/17