Hi there I am trying to link some custom made logic to my microblaze processor. Apparently it is not working (who would have guessed so? :D ) and I wondered if the C code I am using is correct.
1 | int *userlogicaddress; |
2 | userlogicaddress=(int *)XPAR_USERLOGICREADING_0_BASEADDR; |
3 | |
4 | dummy = *userlogicaddress; //reading from base address into dummy |
5 | |
6 | XGpio gpPB; |
7 | XGpio_Initialize(&gpPB, XPAR_LEDS_8BIT_DEVICE_ID); //setting led output port |
8 | XGpio_SetDataDirection(&gpPB, 1, 0x00000000); // setting led port output direction |
9 | XGpio_DiscreteWrite(&gpPB, 1, dummy); // writing dummy from inputs to leds |
The custom logic currently contains only one latch. "Q" side of the latches is connected to the databus the "D" side to pins which are connected to dip switches. "G" is linked to Bus2IP_RdCE It is basically an inital try to read the state of the dip switches into the processor. (I know there are easier ways of doing this but it is just an inital start - the logic will become more complex later on). As the custom logic only contains 1 32-bit data register I assume that the base address is the correct one to work with. Is there any obviours error in accessing the register? If not I have to dig a bit deeper need to look in the VHDL files or the mdp file. Cheers Tobi
Hi Tobi Sorry for my bad english. The instructrions are right. But u have to arrange it in another order. First of all u have to init the XGpio showing in following code: int *userlogicaddress; XGpio gpPB; XGpio_Initialize(&gpPB, XPAR_LEDS_8BIT_DEVICE_ID); //setting led output port XGpio_SetDataDirection(&gpPB, 1, 0x00000000); // setting led port output direction userlogicaddress=(int *)XPAR_USERLOGICREADING_0_BASEADDR; while (1) { dummy = *userlogicaddress; //reading from base address into dummy XGpio_DiscreteWrite(&gpPB, 1, dummy); // writing dummy from inputs to leds } At the moment i can not test this code, cause i dont have any Microblaze-licence. Sorry. Hope i could help u a little bit Greetings Martin
Hi there, could someone please help, what I am trying to do is to read registers on the FPGA on the Spartan 3E starter kit with C implimented code on the Microblaze then perform some arithmatic and return the result back in another register on the FPGA. I dont know where to start, and would be ever so greatful for some help, Lewis