cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
614 Views
Registered: ‎03-17-2017

Reading Zynq-7000 SoC's XUARTPS_FIFO_OFFSET using XSDB

Jump to solution

Hi,

In the case of Zynq-7000 SOCs, using XSDB, is it possible to read UART RX FIFO contents?

FIFO's absolute address is 0xE0001030 (considering Uart1) and read to this is resulting in following error in XSDB

"Memory read error at 0xE0001030. Blocked address 0xe0001030. Cannot access read-once register "

Regards,

Kiran

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Moderator
Moderator
453 Views
Registered: ‎09-12-2007

I have updated the script to allow print, and read for the UART:

proc print {addr string} {
foreach char [split $string ""] {
scan $char %c ascii
set data "0x[format %x $ascii]"
mwr -force $addr $data
}
}

#return the decimal value in the TX FIFO
proc get_data {addr} {
set data [mrd -force $addr]
set data [lindex [split $data " "] 3]
set data 0x[string range $data 6 7]
return [expr $data]
}

proc read {addr buffer} {
set buffer_data ""
while {1} {
set data [get_data $addr]
if {$data != "00000000"} {
lappend buffer_data $data
if {[llength $buffer_data] == $buffer} {
return [binary format c* $buffer_data]
}
}
}
}

connect -url TCP:XIRSTEPHENM32:3121
targets -set -filter {name =~ "APU"}
source ps7_init.tcl
ps7_init
#print 0xe0001030 "Hello Kiran"
#read 0xe0001030 11

 

If I run the read <addr> <buffer>

This will do a while until there is data to read, and return when the amount of characters specified in buffer is fulfilled

View solution in original post

3 Replies
Highlighted
Moderator
Moderator
465 Views
Registered: ‎09-12-2007

You can use the -force switch.

 

For example, I created a simple demo that uses the XSCT to print to the UART1 on a ZC702:

proc print {addr string} {
foreach char [split $string ""] {
scan $char %c ascii
set data "0x[format %x $ascii]"
mwr -force $addr $data
}
}

connect -url TCP:XIRSTEPHENM32:3121
targets -set -filter {name =~ "APU"}
source ps7_init.tcl
ps7_init
print 0xe0001030 "Hello Kiran"

 

If I execute this, I see the data on the serial port:

print.png

Highlighted
Moderator
Moderator
454 Views
Registered: ‎09-12-2007

I have updated the script to allow print, and read for the UART:

proc print {addr string} {
foreach char [split $string ""] {
scan $char %c ascii
set data "0x[format %x $ascii]"
mwr -force $addr $data
}
}

#return the decimal value in the TX FIFO
proc get_data {addr} {
set data [mrd -force $addr]
set data [lindex [split $data " "] 3]
set data 0x[string range $data 6 7]
return [expr $data]
}

proc read {addr buffer} {
set buffer_data ""
while {1} {
set data [get_data $addr]
if {$data != "00000000"} {
lappend buffer_data $data
if {[llength $buffer_data] == $buffer} {
return [binary format c* $buffer_data]
}
}
}
}

connect -url TCP:XIRSTEPHENM32:3121
targets -set -filter {name =~ "APU"}
source ps7_init.tcl
ps7_init
#print 0xe0001030 "Hello Kiran"
#read 0xe0001030 11

 

If I run the read <addr> <buffer>

This will do a while until there is data to read, and return when the amount of characters specified in buffer is fulfilled

View solution in original post

Highlighted
Observer
Observer
438 Views
Registered: ‎03-17-2017

Hi Stephen,

Thanks for the quick reply and the script...

it solved our issue :)

Regards,
Kiran

0 Kudos