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

Share this post


Link to post
Share on other sites

Recommended Posts

  • 1

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  

Share this post


Link to post
Share on other sites
  • 1

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

Share this post


Link to post
Share on other sites
  • 1

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

Share this post


Link to post
Share on other sites
  • 0

Hi @Ahmed Alfadhel,

In the Vivado block design you should use the board tab and select the pmod JD instead of the pmod JA. Unfortunately, we do not have the bandwidth to create the SDK code for the Pmod DA3.  Here is a list of our Pmod's that use the SPI communication like the Pmod DA3.  I would suggest to look at the IP Cores of the SPI communication Pmod's that are in the Vivado Library as a reference for you to make the SDK code for the Pmod DA3 IP core.  I would also use the Arduino code here and the datasheet here as a reference for configuring and using the Pmod DA3. Typically when I create an IP Core I first work on configuring the IC and setting up communication. This might require you to use a bread board and a o-scope to verify that the SPI signals are correct. Then I create the read and write functions. Lastly I manipulate the date to be in the form I would like it to be in. You should only need to alter the PmodDA3.c, PmodDA3.h and the main.c in the Pmod DA3 IP Core. 

thank you,

Jon

Share this post


Link to post
Share on other sites
  • 0

Hi Mr Jon ,

It seems an experienced procedure. 

One thing is unclear for me. Which is  you said I have to use an oscilloscope to verify SPI signals ! 

Do I need to SPI signals when using PmodDA3 module ? I am meaning that I am working with JA connector (GPIO) . Kindly, see the attached picture.

And what is the procedure to verify SPI signals ? is there any reference to do that?

thank u Mr Jon.

spi.JPG

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

Hi @jpeyron,

I altered the main.c code in PmodDA3 IP core, that you attached. 

As follow :

#include <stdio.h>
#include "xparameters.h"
#include "xil_cache.h"
#include "PmodDA3.h"
#include "xiomodule.h"

void DemoInitialize();
void DemoRun();


// Parameters
	u32 data, DAC_writing;


	XIOModule gpo;


// initialize our GPIO's
		data = XIOModule_Initialize(&gpo, XPAR_PMODDA3_0_DEVICE_ID);
		data = XIOModule_Start(&gpo);


PmodDA3 myDevice;

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


	while(1)
				{

					XIOModule_DiscreteWrite(&gpo, 1, data); // Perform DAC Reading

				}


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

void DemoInitialize()
{
	DA3_begin(&myDevice, XPAR_PMODDA3_0_AXI_LITE_GPIO_BASEADDR);
}


void DemoRun()
{

}

Am I on right way ?

And how to verify SPI signals on oscliioscpe ?

Thank you Mr Jon.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0
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

Share this post


Link to post
Share on other sites
  • 0

Hi @Ahmed Alfadhel,

Please attach a screen shot of the IP repository by double clicking into settings under project manager and selecting IP and repository. I have attached a screen shot of this  as well as the contents of the vivado library folder below.

thank you,

Jon

Vivado_library.jpg

Vivado_library_1.jpg

Share this post


Link to post
Share on other sites
  • 0
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.

Edited by Ahmed Alfadhel

Share this post


Link to post
Share on other sites
  • 0

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

Edited by Ahmed Alfadhel

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0
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 

Share this post


Link to post
Share on other sites
  • 0

Hello @jpeyron,

I attached a copy of my design . 

I exported the design to XSDK. Then created a new project with Peripheral Tests Template.

The question is : where I have to add my own code , does it in testperiph.c  or in main.c ?

Thanks for your Support Mr Jon.

design_updated.JPG

src_code.JPG

Share this post


Link to post
Share on other sites
  • 0
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.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now