AndrewD / litecan

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Writing to status register fails

danielkucera opened this issue · comments

Hi,

do you happen to know why any write to STATUS register fails?

litex> mem_write 0x81000006 0x0200

I execute the above and bios freezes. Maybe the write cannot complete? Writing to MODE (0x4) works okay:

litex> mem_write 0x81000004 0x0000

litex> mem_read 0x81000004 2      
Memory dump:
0x81000004  00 00                                            ..              

litex> mem_write 0x81000004 0x0001

litex> mem_read 0x81000004 2      
Memory dump:
0x81000004  10 02                                            ..              

I was stupid - mem_write tries to write 4 bytes by default, status register is 2bytes, and the next register is read-only so it couldn't write it, this works perfectly:

litex> mem_write 0x81000006 0x0240 1 2

litex> mem_read 0x81000000 100        
Memory dump:
0x81000000  fd ca 04 02 10 02 40 02 84 00 02 00 00 00 00 00  ......@.........
0x81000010  10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0x81000020  00 00 00 00 85 a1 50 10 83 61 20 10 60 80 01 00  ......P..a .`...
0x81000030  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0x81000040  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0x81000050  00 00 00 00 00 00 00 00 00 00 00 00 0f 00 00 00  ................
0x81000060  20 00 20 00                                       . .            

litex>