1

I am implementing UART in microblaze xilinx 13.1. I want to store the rx value in fifo which is implemented using xilinx ipcore in VHDL.

I got the received byte like this,

while(1) {
   Recvd_Byte = XUartLite_RecvByte(0x40600000);
}

I have implemented fifo in my VHDL code. Both system.xmp and fifo are components under my top module.

How I can access this Recvd_Byte in C code and pass to the fifo(fifo_wr_data) in VHDL.

Please help me. I am new to the microblaze.

ajay
  • 355
  • 3
  • 8
  • 17

2 Answers2

0

To write the data to the registers in the fpga there are functions in the xil_io.h. The addresses can be seen in the xparameters.h What is the address of the register where you want to write the data?

by Default the IP cores has 32 registers and you read the data from the 0x40600000; that is slv_reg0; Assuming slv_reg1 is free, so you can write data at it's address. the Next register will be at the address 0x40600004; // Assuming the width of the registers are 32 bit

you can use commands 
Xil_Out8(0x40600004);
Xil_Out16(0x40600004);
Xil_Out32(0x40600004); 

or it is also possible to write the data to just next byte usign the commands

Xil_Out8(0x40600001);

// Try to provide more details in the Question.

// We could help you out in a better way.

user3217310
  • 144
  • 1
  • 17
0

You could add a new GPIO peripheral in the EDK. then use GPIO to write the Recvd_Byte into a signal outside the microblaze. So:

  1. open EDK.
  2. add GPIO peripheral. [Image for this instruction][1]

  3. after mapping the address, I suggest to make GPIO_IO_O as external only. [Image for this instruction][2]

  4. After generating netlist. export hardware design to SDK.

  5. this is a simple code to send data outside of Microblaze via GPIO:

    #include "xparameters.h"
    #include "xgpio.h"
    
    XGpio Gpio;
    
    int main (void){
    ...
    int Status;
    Status = XGpio_Initialize(&Gpio, XPAR_XPS_GPIO_0_DEVICE_ID);
    XGpio_SetDataDirection(&Gpio, 1, 0x00000000);
    XGpio_DiscreteWrite(&Gpio, 1,Recvd_Byte );
    ...
    return 0;
    }
    

    [1]: https://i.stack.imgur.com/fr0iG.png [2]: https://i.stack.imgur.com/kAnCK.png

M Shakiba
  • 1
  • 1