The traditional optical networks-on-chip (ONoCs) communication systems is susceptible to crosstalk noise, especially the Wavelength Division Multiplexing (WDM) based ONoCs with nonlinear noise caused by four-wave mixing (FWM) effects. Crosstalk noise greatly reduces the performance and improves the bit error rate (BER) of the ONoCs. In this paper, a low BER communication system in ONoCs based on linear block codes is proposed. Firstly, we designed a all-optical linear block codes generator based on microring resonators(MRRs) to encode the information transmitted in the ONoCs before transmission. Secondly, a retransmission module is established that can resend the code groups that cannot be corrected. Combined with the error detection and error correction features of the linear block code, the BER of the communication in ONoCs can be effectively reduced. Finally, we verify the effectiveness of the proposed method through simulation. The simulation results show that compared with the traditional WDM-based ONoCs, applying the proposed system to ONoCs can greatly reduce the communication BER and effectively improve the communication performance of ONoCs.