The invention discloses a collaborative robot driver based on EtherCAT, hardware FOC and a gallium nitride power transistor and a control method. The driver comprises an MCU microcontroller unit module, an EtherCAT slave station module, a hardware FOC module, a gallium nitride power inversion module, a sensor module, a system protection module, a motor band-type brake module, a power supply module and an external equipment module which are connected with one another. Wherein the MCU microcontroller unit module comprises a minimum peripheral circuit and is responsible for EtherCAT protocol stack processing and hardware FOC related register configuration. The hardware FOC module is responsible for hardware execution of a current loop, a speed loop and a position loop. According to the invention, a highly integrated hardware FOC algorithm and a gallium nitride (GaN) power transistor are adopted, and an EtherCAT bus is adopted to carry out data communication, so that the driver layout space is smaller, the energy consumption is lower, the real-time performance is better, the communication rate is higher, and the inversion efficiency and the precision stability are also higher.