Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
Regular Visitor
caratamity
Posts: 11
Registered: ‎08-10-2009
0
Accepted Solution

UART Problem

I am using UART macro with PicoBlaze as provided with its package. I used it in Spartan 3AN starter kit, and I am sending data to PC via RS-232 port provided in spartan 3AN starter kit. The problem I am having is I am not getting the same data that I am transmitting from my PicoBlaze to PC. The data displayed on PC is not the same which I have transmitted. For example I transmitted 0x01 and the data I got was 0xE0 and there is also another strange behaviour that whenever I try to send 0x0F it doesn't show anything on PC. I am using 50 MHz on board clock and 115200 buad by using a counter of 27 states.

 

Regards,

Caratamity

Expert Contributor
bassman59
Posts: 4,653
Registered: ‎02-25-2008
0

Re: UART Problem


caratamity wrote:

I am using UART macro with PicoBlaze as provided with its package. I used it in Spartan 3AN starter kit, and I am sending data to PC via RS-232 port provided in spartan 3AN starter kit. The problem I am having is I am not getting the same data that I am transmitting from my PicoBlaze to PC. The data displayed on PC is not the same which I have transmitted. For example I transmitted 0x01 and the data I got was 0xE0 and there is also another strange behaviour that whenever I try to send 0x0F it doesn't show anything on PC. I am using 50 MHz on board clock and 115200 buad by using a counter of 27 states.

 

Regards,

Caratamity


Does your PicoBlaze program actually echo back what it received?

 

What program are you running on the PC?


----------------------------------------------------------------
Yes, I do this for a living.
Regular Visitor
caratamity
Posts: 11
Registered: ‎08-10-2009
0

Re: UART Problem

No it does nto echo back.  I am using "DockLight" software in PC for Rs-232 communication. I just send data directly to PC and Docklight shows what data is received.
Expert Contributor
bassman59
Posts: 4,653
Registered: ‎02-25-2008
0

Re: UART Problem


caratamity wrote:
No it does nto echo back.  I am using "DockLight" software in PC for Rs-232 communication. I just send data directly to PC and Docklight shows what data is received.

Ummmm, in a post above you said, "The data displayed on PC is not the same which I have transmitted."

 

Which makes perfect sense if the PicoBlaze doesn't echo it back!


----------------------------------------------------------------
Yes, I do this for a living.
Regular Visitor
caratamity
Posts: 11
Registered: ‎08-10-2009
0

Re: UART Problem

'Hi,

Can you explain it further, please? I did not get it?

Do I need to echo back the data which I send to PC? If yes, why?

 

Actually, I am planing to use it for a camera control which has a UART interface. I decided to check the code on Docklight for any bugs, and found out that the UART is not giving the output which I send through picoBlaze and UART transmits wrong data. 

 

Regards,

Caratamity

Expert Contributor
bassman59
Posts: 4,653
Registered: ‎02-25-2008
0

Re: UART Problem


caratamity wrote:

'Hi,

Can you explain it further, please? I did not get it?

Do I need to echo back the data which I send to PC? If yes, why?


If you expect your local terminal to display what you send TO the device, you must do one of two things:

 

a) Enable "local echo" in your terminal program, or

b) Have your hardware send back to you what you sent to it.

 

It sounds like you want b). Sometimes that is useful. If I implement a serial interface to my FPGA or processor, I use some sort of command protocol which involves decoding what was sent to the board and sending an acknowledge back to the host.


Actually, I am planing to use it for a camera control which has a UART interface. I decided to check the code on Docklight for any bugs, and found out that the UART is not giving the output which I send through picoBlaze and UART transmits wrong data. 

 

Regards,

Caratamity


Oh, so your PicoBlaze handles the incoming (to the FPGA) data in some manner, and is supposed to send something back?


----------------------------------------------------------------
Yes, I do this for a living.
Regular Visitor
caratamity
Posts: 11
Registered: ‎08-10-2009
0

Re: UART Problem

Actually, I need to send some commands in the start to initialize the camera and after inititialization camera responds back with Ack signal.

 

 

In order to test the functionality I used Spartan 3AN starter kit to send the command structure to PC and see whether the code is working properly or not. At the momemt I am not receiving any data or commands, I am just transmitting from the PicoBlaze. The data received on the Personal Computer is not the one that PicoBlaze is transmitting.  May be there is some baud rate problem ? I don't know at the moment. 

After successfully transmitting the correct data from PicoBlaze then I shall consider the receive operation.

Regular Visitor
caratamity
Posts: 11
Registered: ‎08-10-2009
0

Re: UART Problem

;**************************************************************************************
                        ; Port definitions
                        ;**************************************************************************************
                        ;
                        ;
            CONSTANT operation_ctrl_port, 00       ; Switches port
            CONSTANT switch_01, 01                 ; switch 0 at  bit0
                        CONSTANT switch_02, 02                 ; switch 1 at bit 1
            CONSTANT led_disp_port, 08           ; LED display o/p port
            CONSTANT led_01, 01
            CONSTANT led_02, 02
            CONSTANT all_led, FF               ; All LEDs ON   
            ;
            ;   
                        CONSTANT status_port, 01               ;UART and memory status input
                        CONSTANT tx_half_full, 01              ;  Transmitter     half full - bit0
                        CONSTANT tx_full, 02                   ;    FIFO               full - bit1
                        CONSTANT rx_data_present, 04           ;  Receiver     data present - bit2
                        CONSTANT rx_half_full, 08              ;    FIFO          half full - bit3
                        CONSTANT rx_full, 10                   ;                       full - bit4
                        CONSTANT spare1, 20                    ;                  spare '0' - bit5
                        CONSTANT spare2, 40                    ;                  spare '0' - bit6
                        CONSTANT spare3, 80                    ;                  spare '0' - bit7
                        ;
                        CONSTANT UART_read_port, 02            ;UART Rx data input
                        ;
                        CONSTANT UART_write_port, 01           ;UART Tx data output

                         ;**************************************************************************************
                        ; Special Register usage
                        ;**************************************************************************************
                        ;
                        NAMEREG sF, UART_data                  ;used to pass data to and from the UART

                        

                        ;

                        ;

                        ;

   send_sync: LOAD UART_data, AA
                       CALL send_to_UART
                       LOAD UART_data, 0D
                       CALL send_to_UART
                       LOAD UART_data, 00
                      CALL send_to_UART
                      LOAD UART_data, 00
                     CALL send_to_UART
                     LOAD UART_data, 00
                    CALL send_to_UART
                     LOAD UART_data, 00
                    CALL send_to_UART

                    

                    JUMP send_sync

                    ;

                    ;

                    ;

                  

send_to_UART: INPUT s0, status_port                  ;test Tx_FIFO buffer

                        TEST s0, tx_full
                        JUMP NZ, send_to_UART
                        OUTPUT UART_data, UART_write_port      ;write to FIFO
                        RETURN

 

 

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

I am using this code to send the data directly to PC via the RS-232  serial port (DCE) provided on the Spartan 3AN starter Kit. But, the data received in the PC is not the one I send in " send_sync" loop.

Xilinx Employee
chapman
Posts: 411
Registered: ‎09-05-2007
0

Re: UART Problem

Your code indicates that the characters you are send from PicoBlaze are the ASCII codes AA, 0D, 00, 00, 00….

 

Those codes correspond with the characters some kind of graphics character followed by one carriage return and then several NUL characters so I really would not expect to see anything of interest on a PC terminal!

 

It would be better to test things using readable characters such as “Hello”.
Ken Chapman
Principal Engineer, Xilinx UK
Regular Visitor
caratamity
Posts: 11
Registered: ‎08-10-2009
0

Re: UART Problem

Hi, Thank you for your response.

 

Actually, I am not sending ASCII characters to PC. I am sending simple Hexa decimal number. '0A' is just a hexadecimal number. I am using a software called Docklight in PC to detect what has been received on the RS-232 serial port of the PC.  I just want to send simple hexadecimal numbers to PC.