helloworld_ecp5: add delays between messages
Otherwise the FTDI UART goes out of sync and corrupts data.
This commit is contained in:
parent
1cf460b56f
commit
d84b172245
|
@ -22,17 +22,26 @@ class Top(Elaboratable):
|
|||
init=[ord(c) for c in string])
|
||||
m.submodules.rdport = rdport = mem.read_port(synchronous=False)
|
||||
|
||||
wait = Signal()
|
||||
|
||||
tx = uart.RS232TX(round(2**32*self.baudrate/100e6))
|
||||
m.submodules.tx = tx
|
||||
m.d.comb += [
|
||||
tx.stb.eq(1),
|
||||
tx.stb.eq(~wait),
|
||||
tx.data.eq(rdport.data),
|
||||
self.serial_tx.eq(tx.tx)
|
||||
]
|
||||
|
||||
with m.If(tx.ack):
|
||||
release = Signal()
|
||||
counter = Signal(25)
|
||||
m.d.sync += Cat(counter, release).eq(counter + 1)
|
||||
with m.If(release):
|
||||
m.d.sync += wait.eq(0)
|
||||
|
||||
with m.If(~wait & tx.ack):
|
||||
with m.If(rdport.addr == len(string) - 1):
|
||||
m.d.sync += rdport.addr.eq(0)
|
||||
m.d.sync += wait.eq(1)
|
||||
with m.Else():
|
||||
m.d.sync += rdport.addr.eq(rdport.addr + 1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue