fix the bugs

put the code into the singelchip and do some debug