Jump to content
  • 0

Source Code in SDK


Ahmed Alfadhel

Question

Hi @jpeyron, @D@n , @Mahdi

I completed my block diagram design in Vivado, and I used Microblaze IP for AXI control, and PmodDA3 IP.  (1st picture)

But , I want to know how to assign Constraints to the JD Connector and what are source code that should be written in SDK ? 

I am using Arty 7. 

Kindly, see the attached pictures.

Looking forward your help.

Thanks .

design_completed.JPG

photo_2018-12-22_00-55-08.jpg

Link to comment
Share on other sites

Recommended Posts

On 1/3/2019 at 12:35 AM, jpeyron said:

Hi @Ahmed Alfadhel,

Looking through your previous post it appears that I gave you an incorrect generic IP core. The Pmod DA3 communicates through SPI as shown on the Pmod DA3 resource center here and not through GPIO. I have attached the correct generic SPI IP Core below. J6 is a SPI connector typically associated with the Arduino/Chipkit header and used with a shield like the MTDS.  Most of the Digilent SPI Pmod IP Cores are designed to use SPI through the Pmod Ports instead of the J6 connector.  

thank you,

Jon  

PmodDA3_v1_0.zip

Kindly @jpeyron,

you adviced me to use this IP

https://forum.digilentinc.com/applications/core/interface/file/attachment.php?id=8967

and not that located in vivado library. Because you updated the IP core to work with SPI protocol.

So, back to our point, I still need the "if" folder. Because it is missed in link above.

Thank you for your active follow up Mr Jon.

Link to comment
Share on other sites

Hi @Ahmed Alfadhel,

WriteSPI = Writes the byte array to the chip via SPI. It will write the first byte into the specified register, then the next into the following register until all of the data has been sent.

WriteByte = Only writes a single byte over SPI

I believe you should be able to use either function It depends on how you are wanting to transfer data.

thank you,

Jon

Link to comment
Share on other sites

Hi @Ahmed Alfadhel,

My understanding is that you should be able to use the brams functions on you original projects "main.c.".  I had suggest to make the xilinx example to be able to look at the way they use the function so you can better use them in your project. I would suggest to try and see what happens. Neither Xilinx or I have the exact hardware project that you are working on to verify our suggestions. This might be a situation where you will need to spend some time evaluation what is going on in your hardware and c application. 

thank you,

Jon

Link to comment
Share on other sites

1 hour ago, jpeyron said:

Hi @Ahmed Alfadhel,

Once you have looked through the xilinx example for the bram then I believe you should be using the bram code used in the testperiph.c file  to help you with interacting with  the bram in your main.c.

thank you,

Jon

Hi @jpeyron,

Kindly, could you give me your feedback about this answer from Xilinx Forum.

https://forums.xilinx.com/t5/7-Series-FPGAs/Writing-My-own-code-in-XSDK/td-p/930640

Does it true, that I have to work in testperiph.c file only ?

Thanks in advance.

Link to comment
Share on other sites

20 hours ago, jpeyron said:

Hi @Ahmed Alfadhel,

With a quick search I found on page 62 of the Native High-Speed I/O Interfaces it describes U.  I believe that this idea is part of their #define for U. I would also suggest to reach out the Xilinx about this. I did a search for #define U with no results so I would guess that the #define U is not publicly shared by Xilinx.

thank you,

Jon

Hi @jpeyron,

I got an answer for my question, 

Kindly , have a look :

https://forums.xilinx.com/t5/Embedded-Development-Tools/Macros-end-by-U-in-XSDK/m-p/930465#M48062

Thanks 

Link to comment
Share on other sites

Hi @Ahmed Alfadhel,

With a quick search I found on page 62 of the Native High-Speed I/O Interfaces it describes U.  I believe that this idea is part of their #define for U. I would also suggest to reach out the Xilinx about this. I did a search for #define U with no results so I would guess that the #define U is not publicly shared by Xilinx.

thank you,

Jon

Link to comment
Share on other sites

Hello @jpeyron,

While I was checking IOMODULE Macros in xparameters.h file ,

I found many Macros ending with U , like these below:

#define XPAR_IOMODULE_0_USE_GPI1 1U
#define XPAR_IOMODULE_0_GPI1_SIZE 32U

In fact I looked through  pg111 and I knew the purpose of each these above Macros, but the "U" isn't not mentioned in the manual .

For what stand the "U" ?

Looking forward your explanation.

Thanks in advance

Link to comment
Share on other sites

On 1/3/2019 at 12:35 AM, jpeyron said:

Hi @Ahmed Alfadhel,

Looking through your previous post it appears that I gave you an incorrect generic IP core. The Pmod DA3 communicates through SPI as shown on the Pmod DA3 resource center here and not through GPIO. I have attached the correct generic SPI IP Core below. J6 is a SPI connector typically associated with the Arduino/Chipkit header and used with a shield like the MTDS.  Most of the Digilent SPI Pmod IP Cores are designed to use SPI through the Pmod Ports instead of the J6 connector.  

thank you,

Jon  

PmodDA3_v1_0.zip

Hello Mr @jpeyron,

I clicked on validate my design button in Vivado , but a pop up message appeared , which is saying :

" [BD 41-49] Could not find abstraction definition for the interface: Pmod_out " ,

as attached picture is showing that.

Could, you tell me how to add the definition for Pmod interface (Pmod_out) , in order to suppress this critical warning?

Thanks in advance
 

Validation_of_design.JPG

Link to comment
Share on other sites

Hi @Ahmed Alfadhel,

I believe you should be able to read the data from the multiplier and the constant in the bram and send it out through the PmodDA3. For the BRAM you should use the functions in 'xil_io.h'.

Xil_out8, Xil_Out16, Xil_Out32 to write

Xil_in8, Xil_in16, Xil_in32 to read

then you need to find the address of your BRAM -> check xparameters.h

and for the PmodDA3 you will want to do something similar to the PmodDA1 main.c here.

DA1_WritePhysicalValue(&myDevice, dValue);

So you will need to put the bram value in place of dValue in the above function.

You will need a function similar to DA1_WritePhysicalValue in PmodDA3.c and PmodDA3.h

Hopefully this gets you going in the right direction!

Jon

Link to comment
Share on other sites

Hi @jpeyron,

I updated the code of main.c , 

I don't know how to write a code that transfer the Multiplier signal to PmodDA3 .

Kindly, see the attached picture of my design. And I also pasted the main.c code.

Looking forward your reply.

  

/******************************************************************************/
/* File Description:                                                          */
/*                                                                            */
/* This file defines a demonstration for the use of the PmodDA3 IP core.      */
/* -------------------------------------------------------------------------- */




#include "xparameters.h"
#include "xil_cache.h"
#include "PmodDA3.h"

void DemoInitialize();
void DemoRun();
void DemoCleanup();
void EnableCaches();
void DisableCaches();



PmodDA3 myDevice;

int main(void)
{
	//Xil_ICacheEnable();
	//Xil_DCacheEnable();

	DemoInitialize();
	DemoRun();
	DemoCleanup();
	return 0;
}

void DemoInitialize()
{
	EnableCaches();
	DA3_begin(&myDevice, XPAR_PMODDA3_0_AXI_LITE_SPI_BASEADDR);
}


void DemoRun()
{


   while(1)
   {
         // Send value from dout PIN to the DA converter
	   	 // ????????????????????????????????????????????

   }

}


void DemoCleanup() {
   DA3_end(&myDevice);
   DisableCaches();
}

void EnableCaches() {
#ifdef __MICROBLAZE__
#ifdef XPAR_MICROBLAZE_USE_ICACHE
   Xil_ICacheEnable();
#endif
#ifdef XPAR_MICROBLAZE_USE_DCACHE
   Xil_DCacheEnable();
#endif
#endif
}

void DisableCaches() {
#ifdef __MICROBLAZE__
#ifdef XPAR_MICROBLAZE_USE_DCACHE
   Xil_DCacheDisable();
#endif
#ifdef XPAR_MICROBLAZE_USE_ICACHE
   Xil_ICacheDisable();
#endif
#endif
}



Thanks in advance

dout.JPG

Link to comment
Share on other sites

Hi @Ahmed Alfadhel,

Here is a basic explanation of SPI communication. Here is the AXI Quad SPI v3.2 LogiCORE IP Product Guide, Here is the Pmod DA3 resource center that shows the pin out.   By looking at the datasheet and the arduino code you should be able to see how the spi communication works for this specific Pmod.

thank you,

Jon

Link to comment
Share on other sites

Hi @Ahmed Alfadhel,

I would suggest looking at the Pmod DA1  here as an example for the Pmod DA3 main.c PmodDA3.h and PmodDA3.c .   The arduino code and datasheet linked on the Pmod DA3 resource center here will help with configuring the DA3_SPIInit(). I use a bread board to gain access to the signals going from and to the Pmod DA3 to the Pmod port.  I use the logic analyzer function of our Analog Discovery 2 to see what is happening if I am having problems communicating with the PmodDA3. 

thank you,

Jon  

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...