adrianomarto / soft_uart

Software-based serial port module for Raspberry Pi.
GNU General Public License v3.0
159 stars 83 forks source link

Bit error when in AR9331 #4

Open YYYaoSir opened 6 years ago

YYYaoSir commented 6 years ago

I compile and install this kmod in AR9331(400MHZ Mips Soc). It works. I can use the ttySOFT0 to transmit and recieve. But it always encounters some bit error. I modified some of the code, now it works well.

1: Change the RX trigger from "IRQF_TRIGGER_FALLING" to "IRQF_TRIGGER_LOW". 2: In handle_rx_start(), after start the timer, disable the RX_IRQ if (rx_bit_index == -1) { hrtimer_start(&timer_rx, ktime_set(0, 0), HRTIMER_MODE_REL); } disable_irq_nosync(gpio_to_irq(gpio_rx)); return (irq_handler_t) IRQ_HANDLED; 3: After has recieved a byte, enable the RX_IRQ. receive_character(character); rx_bit_index = -1; enable_irq(gpio_to_irq(gpio_rx));

It reduce the bit error when RX receive bits significantly. I haven't test it in Raspberry pi. You can test it. Maybe it will improve the baud rate.

adrianomarto commented 6 years ago

Hi YYYaoSir,

Thanks for the suggestion. I will definitively try it.

Kind regards,

Adriano.

adrianomarto commented 5 years ago

Hi @YYYaoSir,

@ulde has provided a different solution for what seems to be the same problem you are experiencing. Would you mind trying his modification and verifying if it reduces the bit errors?

See: https://github.com/adrianomarto/soft_uart/pull/5 Kind regards,

Adriano.