BafangBBS02 750W error 21 and 4


I just received an e-bike with a Bafang BBS02 750w pre-installed. After assembling it, I took a short ride test. After about 400 meters working OK, a red alert appeared on the DPC 18 display:"Speed sensor problem" Then I lost all power assist. Back home, I checked the error codes: 21 and 04. I know that error 21 is related to the speed sensor. At first, the speed sensor led was always on, even when the wheel was not spinning. What caused that problem? As for error 4 throttle related. I unplugged and replugged the throttle cable but the 04 error did not go away.
Any suggestion would be greatly appreciated.
The red led on the speed sensor should be always on. Try unplugging and plugging it back in. Does the spoke magnet line up with the speed sensor? The notched screw side should be facing out, with the flat side facing the speed sensor.
After double checking, I read correct voltage coming from the controller to the speed sensor, but the speed sensor light never comes on. I guess the speed sensor which is brand new is already dead.