UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor amaye
Visitor
31,294 Views
Registered: ‎01-15-2008

Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
Hello,

I have to set up a simple microblaze system on our FPGA board. I actually have the system up and running ( I can do step tracing of my application over JTAG, etc.. ).

My latest problem is to enable the UART over JTAG. The mdm peripheral has the following parameters :

BEGIN mdm
 PARAMETER INSTANCE = debug_module
 PARAMETER HW_VER = 1.00.a
 PARAMETER C_MB_DBG_PORTS = 1
 PARAMETER C_USE_UART = 1
 PARAMETER C_UART_WIDTH = 8
 PARAMETER C_BASEADDR = 0x84400000  ( assigned by EDK as a default value )
 PARAMETER C_HIGHADDR = 0x8440ffff ( assigned by EDK as a default value )
 BUS_INTERFACE SPLB = mb_plb
 BUS_INTERFACE MBDEBUG_0 = microblaze_0_dbg
 PORT Debug_SYS_Rst = Debug_SYS_Rst
END

I believe my "Platform Studio SDK" is not yet correctly configured. Each time I try to step over a print() call, the application "freezes" in fact the application loop try to send  byte to the "virtual uart".

For example after launching the debug, The debugger breaks to my breakpoint just before the print() function. If I do a "step over", the application loops in XUartLite_SendByte function :

while (XUartLite_mIsTransmitFull(BaseAddress)); < it continuously loops here..

It seems like the uart buffer is full and then it refuses to send out any data.

After reading on internet I've seen I should start the terminal from the XMD console. So I've tried to open the terminal before to stepover my print(). XMD does not want that, here is the answer :

XMD% terminal
ERROR:  In order to use the MDM UART (UART over JTAG) functionality,
    You must first initialize XMD with the following command
    (with optional JTAG chain options) :
    connect mdm -uart
           OR
    connect mb mdm [-configdevice devicenr <n> irlength <len>....]

So it seems that when eclipse invoke XMD it does not try to connect MDM uing uart. As a side note. When I connect the MDM from XPS EDK, the xmd shows that I am connected to UART MDM

Where in eclipse ( Xilinx Platform Studio SDK ) should I set that I want an UART MDM connection?
Do I real need to launch a terminal to see my print() output (stdout) ?

Any help, pointers or solution would be greatly appreciated.

Thank you

Arnaud


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
XMD Console output ( after starting up Platform Studio SDK ):
--------------------------------------------------------------------------------
Xilinx Microprocessor Debug (XMD) Engine
Xilinx EDK 9.2.02 Build EDK_Jm_SP2.3
Copyright (c) 1995-2007 Xilinx, Inc.  All rights reserved.


Processor(s) in System ::

Microblaze(1) : microblaze_0
Address Map for Processor microblaze_0
  (0000000000-0x00001fff) dlmb_cntlr    dlmb
  (0000000000-0x00001fff) ilmb_cntlr    ilmb
  (0x81400000-0x8140ffff) LEDS    mb_plb
  (0x84400000-0x8440ffff) debug_module    mb_plb


Accepted a new TCLSock connection from 127.0.0.1 on port 1999


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
XMD Console output ( after launching debug session from the eclipse's run menu ):
------------------------------------------------------------------------------------------------------------

Info:Connecting to cable (Usb Port - USB21).
Info:Checking cable driver.
Info: Driver version: 1027 (1027).
Info: Driver windrvr6.sys version = 8.1.1.0.Info: WinDriver v8.11 Jungo (c) 1997 - 2006 Build Date: Oct 16 2006 X86 32bit SYS 12:35:07, version = 811.
PORT_INDEX = 0.
CB_CABLE_COUNTER = 0.
DeviceAttach: Cable found for usb21.
Calling setinterface num=0, alternate=0.
DeviceAttach: received and accepted attach for:
  vendor id 0x3fd, product id 0x8, device handle 0x2d50038
Info: Cable PID = 0008.
Info: Max current requested during enumeration is 74 mA.
Info:Type = 0x0004.
JTAG chain configuration
--------------------------------------------------
Device   ID Code        IR Length    Part Name
 1       16d4b093           8        xc2c256_cp132_1532
 2       21e64093          10        xc4vfx20
 3       516d8093          10        xc4vlx80

MicroBlaze Processor Configuration :
-------------------------------------
Version............................7.00.b
Optimization.......................Performance
Interconnect.......................PLBv46
MMU Type...........................No_MMU
No of PC Breakpoints...............1
No of Read Addr/Data Watchpoints...0
No of Write Addr/Data Watchpoints..0
Instruction Cache Support..........off
Data Cache Support.................off
Exceptions  Support................off
FPU  Support.......................off
Hard Divider Support...............off
Hard Multiplier Support............on - (Mul32)
Barrel Shifter Support.............off
MSR clr/set Instruction Support....on
Compare Instruction Support........on
Info: Cable Type = 3, Revision = 0.
Info: Setting cable speed to 6 MHz.
Info:Cable connection established.
Info:Firmware version = 1301.
Info:File version of C:/Xilinx92i/data/xusb_xlp.hex = 1301.
Info:Firmware hex file version = 1301.
Info:ESN Family Code: 01
Info:ESN: 000011657679
Info:CPLD file version = 0012h.
Info:CPLD version = 0012h.
0
Info:
Accepted a new GDB connection from 127.0.0.1 on port 2041

0 Kudos
1 Solution

Accepted Solutions
Visitor amaye
Visitor
37,757 Views
Registered: ‎01-15-2008

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
The problem is solved.

The xilinx FAE finally pointed out the problem. He asked me to try a parrallel cable IV instead using an usb cable.

The JTAG over UART works as a charm using a parrallel cable IV. On the same application, same system,
it is not working using an usb cable.

I guess  this is a firmware issue in  the usb cable. The FAE said it could take 3 weeks to obtain a fix, so
hopefully this is gonna be fixed soon.

Thanks for people involved in this thread. It is amazing, this kind of bug is time consuming.
I mean how could someone guess this is related to the programming cable. Especially the same
programming cable is able to upload bit files using impact!

Best regards!


View solution in original post

0 Kudos
13 Replies
Visitor cciressan
Visitor
31,285 Views
Registered: ‎01-04-2008

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
Hello,
 
Seems like your JTAG and MDM are up and running (if you can step through the code...).
 
The UART is "emulated" over JTAG and this "emulation" has to be reverted on the PC-side by something else than
a standard COM terminal... and this is the XMD.
 
In 9.1 I used the command below to start the terminal (hope this is true for 9.2 too :)):
>>> terminal -jtag_uart_server
 
This will display information from "print", "xil_printf" etc.
Also make sure that:
1) You enabled the UART interface on the MDM component
2)  "Software->Software patform settings->OS and libraries" STDOUT and STDIN point to your MDM instance.
3)  "Software->Software patform settings" the xmdstub_peripheral is "none".
 
What you said about the buffer is also true. Try using a "\n" (or maybe "\r\n") to flush the print buffer. I think it
does not send data until a "\n" ends the string...
 
However, I would strongly recomend to use a real UART if available on your board and not this emulation.
It is a lot more convenient.
 
 Good luck,
CRC
 
 
 
 
0 Kudos
Explorer
Explorer
31,258 Views
Registered: ‎08-14-2007

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
The MHS connection seems correct, but you can let the tool itself to add this MDM JTAG by "Debug --> Debug Configuration --> Jtag Uart --> Enable".
0 Kudos
Visitor amaye
Visitor
31,127 Views
Registered: ‎01-15-2008

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
Hello, Thank you for you answer!

I am still stuck with the same problem actually.

However I've got some more details, maybe this will help to diagnose.

So BSB decided this address range for the MDM peripheral:

(0x84400000-0x8440ffff) debug_module    mb_plb

Looking at the MDM datasheet we can guess address of the UART FIFOs

0x84400000 ( Rx_FIFO )
0x84400004 ( Tx_FIFO )

I've done the following steps :

1) Un marked TestApp_Memory to initialize bram
2) Marked microblaze_0_bootloop to initialize bram ( this comes from a FAE, it should fix a bug in EDK 9.2... )
3) I've launched the XMD session, I get the connected to MDM UART peripheral
4) I've typed "terminal -jtag_uart_server"

XMD then showed me the following :
JTAG-based Terminal Server.
(TCP Port no used is 4321)

XMD%

5) Using windows's hyperterminal, connected over winsock to the port 4321 ( Hyperterminal shows the connection ) and XMD showed :

XMD% Accepted connection from 127.0.0.1 localhost 1468

JTAG Hyperterminal Started
-----------------------------------------------------

So far so good, I believe everything is all right so far. Here are initial status of the MDM registers:

XMD% mrd 0x84400000
84400000:   00000000

XMD% mrd 0x84400001
84400001:   00000000

XMD% mrd 0x84400002
84400002:   00000000

XMD% mrd 0x84400003
84400003:   00000000

XMD% mrd 0x84400004
84400004:   00000000

XMD% mrd 0x84400005
84400005:   00000000

XMD% mrd 0x84400006
84400006:   00000000

XMD% mrd 0x84400007
84400007:   00000000

XMD% mrd 0x84400008
84400008:   00000004

XMD% mrd 0x84400009
84400009:   00000004

XMD% mrd 0x8440000a
8440000A:   00000004

XMD% mrd 0x8440000b
8440000B:   00000004

XMD% mrd 0x8440000c
8440000C:   00000000

XMD% mrd 0x8440000d
8440000D:   00000000

XMD% mrd 0x8440000e
8440000E:   00000000

XMD% mrd 0x8440000f
8440000F:   00000000


>Let's try to type '12' <enter>  in the terminal and see :

XMD% mrd 0x84400000
84400000:   00000031

XMD% mrd 0x84400001
84400001:   00000032

XMD% mrd 0x84400002
84400002:   0000000A

XMD% mrd 0x84400003
84400003:   0000000A

XMD% mrd 0x84400004
84400004:   0000000A

XMD% mrd 0x84400005
84400005:   0000000A

XMD% mrd 0x84400006
84400006:   0000000A

XMD% mrd 0x84400007
84400007:   0000000A

XMD% mrd 0x84400008
84400008:   00000004

XMD% mrd 0x84400009
84400009:   00000004

XMD% mrd 0x8440000a
8440000A:   00000004

XMD% mrd 0x8440000b
8440000B:   00000004

XMD% mrd 0x8440000c
8440000C:   0000000A

XMD% mrd 0x8440000d
8440000D:   0000000A

XMD% mrd 0x8440000e
8440000E:   0000000A

XMD% mrd 0x8440000f
8440000F:   0000000A

So the communication HOST to MDM is operating as expected! I can write something in the terminal and obtain the pressed keys in the Rx_fifo.

Still I did not expect to see 0x0A between 0x84400004 and 0x84400007 as it is supposed to be Tx_fifo area.

I did not expect to see 0x0A between 0x8440000C and 0x8440000F as it is supposed to be ctrl_reg area.

As well as I would expect 0x84400003 to be 0x00 and not 0x0A

0x84400000 = 0x31 ( Correct , '1')
0x84400001 = 0x32 ( Correct , '2')
0x84400002 = 0x0A ( Correct , \n)

>Now I am gonna try to write '56\n' in the Tx_fifo to see what is going on

XMD% mwr 0x84400004 0x35
XMD% mwr 0x84400005 0x36
XMD% mwr 0x84400006 0x0a
XMD% mrd 0x84400004
84400004:   0000000A

XMD% mrd 0x84400005
84400005:   0000000A

XMD% mrd 0x84400006
84400006:   0000000A

It is strange it seems I cannot write there.

Register state at this time :

XMD% mrd 0x84400000
84400000:   0000000A

XMD% mrd 0x84400001
84400001:   0000000A

XMD% mrd 0x84400002
84400002:   0000000A

XMD% mrd 0x84400003
84400003:   0000000A

XMD% mrd 0x84400004
84400004:   0000000A

XMD% mrd 0x84400005
84400005:   0000000A

XMD% mrd 0x84400006
84400006:   0000000A

XMD% mrd 0x84400007
84400007:   0000000A

XMD% mrd 0x84400008
84400008:   00000000

XMD% mrd 0x84400009
84400009:   00000000

XMD% mrd 0x8440000a
8440000A:   00000000

XMD% mrd 0x8440000b
8440000B:   00000000

XMD% mrd 0x8440000c
8440000C:   0000000A

XMD% mrd 0x8440000d
8440000D:   0000000A

XMD% mrd 0x8440000e
8440000E:   0000000A

XMD% mrd 0x8440000f
8440000F:   0000000A

using xil_printf keep giving me same results, I am not able to initiate a MDM to HOST communication for some reasons.

Do you guys have any ideas about this problem? Does it sound familiar?

Great thanks!

am








0 Kudos
Visitor amaye
Visitor
31,126 Views
Registered: ‎01-15-2008

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
A correction ( sorry ):
---------------------------

This was wrong !!!

>Now I am gonna try to write '56\n' in the Tx_fifo to see what is going on

XMD% mwr 0x84400004 0x35
XMD% mwr 0x84400005 0x36
XMD% mwr 0x84400006 0x0a
XMD% mrd 0x84400004
84400004:   0000000A

XMD% mrd 0x84400005
84400005:   0000000A

XMD% mrd 0x84400006
84400006:   0000000A

In fact writing '56\n' is done that way :
XMD% mwr 0x84400004 0x35
XMD% mwr 0x84400004 0x36
XMD% mwr 0x84400004 0x0a

Reading back the address 0x84400004 is in fact pointless ( at least on my system the value remain unchanged )

I can see that when the MDM UART starts the status is TX_BUFFER Empty (0x04).

After the first writing to 0x84400004 TX_BUFFER empty flag goes to 0, the whole status register is then 0

Reading the C headers, I've seen the FIFO size is 16 bytes. I've been able to confirm this.

For instance after writing 0x0A 13 times after ( so totally : '5', '6' and 14 times '\n') the TX_BUFFER full flag goes to 1, the whole status register is then 0x08


So yeah, I keep saying communication HOST to MDM is operating as expected. MDM peripheral seems to operate properly. Communication MDM to HOST is not working.


This is strange as I believe TDO/TDI signals are used for this purpose. I am using a Xilinx USB programming cable. 6 jtag cables are tied to our hardware. The 7th cable ( grey, "INIT" is left unconnected )

That's it. This whole problem is quite frustrating. I keep believing I am doing something wrong. The Xilinx FAE are helpless. We have no UART phy on board. I have no Xilinx Eval boards. So for now I've got
a "non working system" only.

Thanks again
0 Kudos
Visitor amaye
Visitor
37,758 Views
Registered: ‎01-15-2008

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution
The problem is solved.

The xilinx FAE finally pointed out the problem. He asked me to try a parrallel cable IV instead using an usb cable.

The JTAG over UART works as a charm using a parrallel cable IV. On the same application, same system,
it is not working using an usb cable.

I guess  this is a firmware issue in  the usb cable. The FAE said it could take 3 weeks to obtain a fix, so
hopefully this is gonna be fixed soon.

Thanks for people involved in this thread. It is amazing, this kind of bug is time consuming.
I mean how could someone guess this is related to the programming cable. Especially the same
programming cable is able to upload bit files using impact!

Best regards!


View solution in original post

0 Kudos
Explorer
Explorer
30,052 Views
Registered: ‎11-13-2007

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution

I was in search of an answer to the same problem you had (while (XUartLite_mIsTransmitFull(BaseAddress)); < it continuously loops here..)

and I see you found a solution finally but unfortunately for me, that doesn't work because I don't have that cable. I also don't have a parallel port on my machine, so if I did have the cable it wouldn't do me any good.

 

I haven't tryed running 10.1 yet. I wonder if they fixed it???

0 Kudos
Contributor
Contributor
27,049 Views
Registered: ‎10-29-2007

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution

I have tried MDM uart as a debug tool and what I have experienced is that the MDM freeze when the cache is enabled!! When chache is disabled it works most of the time.... (Tested with 10.1)

 

0 Kudos
Explorer
Explorer
26,023 Views
Registered: ‎12-06-2007

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution

Based on the coding below , I can not receive anything from the hyperterminal. How can I rectify the problem , so that I can receive data from the hyperterminal and display it back to the hyperterminal? I tried to debug , but there is no value assign to t . If the coding is wrong, should I use array.

 

 

#include "xparameters.h"
#include "xuartlite.h"


#define UART_BASEADDR XPAR_UARTLITE_0_BASEADDR
#define ESCAPE 0x1b


static void myprintf (char *s)
{
  char t;
 
  while (*s)
  {
   XUartLite_SendByte (UART_BASEADDR ,*s ); // Able to send to Hyperterminal
   s++;
  }
 
  
 do
 {
   /*Problem is here. It should receive data from hyperterminal and display it back.
   But it does not work.How should I rectify it? */
     t = XUartLite_RecvByte(UART_BASEADDR); //Receive
     XUartLite_SendByte (UART_BASEADDR , t ); //Send
    
 } while (t != ESCAPE);
 
}


int main()
{
 myprintf("Good morning");
 
 
 return 0;
}

 

This is the UCF , which automatically generated by using XPS 9.2 

 

Net sys_clk_pin LOC=AE14;
Net sys_clk_pin IOSTANDARD = LVCMOS33;
Net sys_rst_pin LOC=D6;
Net sys_rst_pin PULLUP;
 

## System level constraints
Net sys_clk_pin TNM_NET = sys_clk_pin;
TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 10000 ps;
Net sys_rst_pin TIG;

 

## IO Devices constraints

#### Module RS232_Uart constraints

Net fpga_0_RS232_Uart_RX_pin LOC=W2;
Net fpga_0_RS232_Uart_RX_pin IOSTANDARD = LVCMOS33;
Net fpga_0_RS232_Uart_TX_pin LOC=W1;
Net fpga_0_RS232_Uart_TX_pin IOSTANDARD = LVCMOS33;

0 Kudos
Explorer
Explorer
26,022 Views
Registered: ‎12-06-2007

Re: UART over hyperterminal

Jump to solution

Based on the coding below , I can not receive anything from the hyperterminal. How can I rectify the problem , so that I can receive data from the hyperterminal and display it back to the hyperterminal? I tried to debug , but there is no value assign to t . If the coding is wrong, should I use array.

 

 

#include "xparameters.h"
#include "xuartlite.h"


#define UART_BASEADDR XPAR_UARTLITE_0_BASEADDR
#define ESCAPE 0x1b


static void myprintf (char *s)
{
  char t;
 
  while (*s)
  {
   XUartLite_SendByte (UART_BASEADDR ,*s ); // Able to send to Hyperterminal
   s++;
  }
 
  
 do
 {
   /*Problem is here. It should receive data from hyperterminal and display it back.
   But it does not work.How should I rectify it? */
     t = XUartLite_RecvByte(UART_BASEADDR); //Receive
     XUartLite_SendByte (UART_BASEADDR , t ); //Send
    
 } while (t != ESCAPE);
 
}


int main()
{
 myprintf("Good morning");
 
 
 return 0;
}

 

This is the UCF , which automatically generated by using XPS 9.2 

 

Net sys_clk_pin LOC=AE14;
Net sys_clk_pin IOSTANDARD = LVCMOS33;
Net sys_rst_pin LOC=D6;
Net sys_rst_pin PULLUP;
 

## System level constraints
Net sys_clk_pin TNM_NET = sys_clk_pin;
TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 10000 ps;
Net sys_rst_pin TIG;

 

## IO Devices constraints

#### Module RS232_Uart constraints

Net fpga_0_RS232_Uart_RX_pin LOC=W2;
Net fpga_0_RS232_Uart_RX_pin IOSTANDARD = LVCMOS33;
Net fpga_0_RS232_Uart_TX_pin LOC=W1;
Net fpga_0_RS232_Uart_TX_pin IOSTANDARD = LVCMOS33;

0 Kudos
Visitor safa_alai
Visitor
6,350 Views
Registered: ‎02-01-2009

Re: UART over hyperterminal

Jump to solution

If you are using XPS SDK:

 

1.  Go to XMD Console (found by clicking on the C/C++ tab then finding the console tab at the bottom of the screen)

2.  Type: read_uart start

 

This will provide a reader for the print/printf commands.  Releasing the output then allows the program to resume.

Highlighted
Visitor sachinm1984
Visitor
6,111 Views
Registered: ‎03-24-2010

Re: UART over hyperterminal

Jump to solution

Hello,

 

I am having a similar problem. I have added ILA core through the debug configuration in EDK. If I do not check the option of JTAG UART interface as I want to use the on-board RS232 connection, it gives me the following error:

 

ERROR:MDT - IPNAME:mdm INSTANCE:debug_module BUS_INTERFACE:SPLB -
  .....\MicroBlaze.mhs line 130 - invalid bus interface in use when ISVALID="((C_INTERCONNECT == 1) &&
   (C_USE_UART == 1))" evaluates to FALSE. Please remove the bus interface from
   your design!

 

But if I do check the option using the JTAG UART interface, I have to use JTAG terminal from XMD. In this case, the program can output to the terminal but it cannot take any input from the terminal and gets stuck while receiving data in the XUartLite_RecvByte function.

 

 

Do I have to use the JTAG UART interface if I add an ILA in EDK? If I have to, how will I be able to get input from the terminal? Please help.

 

 

Regards,

 

Sachin

Message Edited by sachinm1984 on 04-07-2010 11:56 PM
Message Edited by sachinm1984 on 04-07-2010 11:56 PM
0 Kudos
Observer gs_cmans
Observer
5,900 Views
Registered: ‎04-19-2010

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution

Any updates on this issue yet?

 

I am having a problem where print(..) works fine if i execute step by step; But if i run continue on debugger, it hangs.

 

NOTE: I had to have cache enabled, for this to work by GDB stepping though.

0 Kudos
Visitor tcheguevara
Visitor
4,119 Views
Registered: ‎12-14-2013

Re: Platform Studio SDK > UART over JTAG, print() freezes

Jump to solution

Hi,

I'm workink right  now in a project using the  FPGA  Virtex 5, i've tried hard to make uart over jtag working but i failed. So can you be more specific on this steps below  that you describe in your post :


1) Un marked TestApp_Memory to initialize bram
2) Marked microblaze_0_bootloop to initialize bram ( this comes from a FAE, it should fix a bug in EDK 9.2... )
3) I've launched the XMD session, I get the connected to MDM UART peripheral
4) I've typed "terminal -jtag_uart_server"

How can i unmark TestApp_Memory (i know that it is an example of xilinx project in SDK)?

How can mark microblaze_0_bootloop to initialize bram?

 

For informations, here the differents stepp i did in my design :

1) i've pointed the stdin and stdout to the mdm

2) i typed connect mdm -uart in XMD console and then i typed terminal.

 

the terminal show that the connexion has been etablished but and i was expecting to have a simple helloword but nothing happens (see the picture that i've joined).

 

I've verified the xparameters.h header file and i found that of the parameter of the mdm uart was 0 ( baudrate, parity type etc... ). I check  my MHS file, i found that the mdm uart configuration is right. so i do not understand were is the problem.

 

Help me please!

mdm.png
0 Kudos