UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor vipulreddy
Visitor
5,538 Views
Registered: ‎07-31-2012

Constraint file error when reading from breadboard

Hi everyone,

 

I'm using a Spartan 3 FPGA board XC3S400 and as part of my project, I'm using a breadboard (FX2-BB) where I have connected my temperature sensors. I'm trying to read the signal from the sensors. The signal from the sensors is a 40 bit signal.

I have the correct pin assignments (I'm only using one pin on the breadboard to read the signal from).

 

Now, in my VHDL file, I have my data_in port declared as a std_logic_vector (39 downto 0).  In my constraints file, I'm assigning the pin on the breadboard that I read from to the data_in port. Now, I don't know if I'm doing this right or not, but the constraint file would not compile. The reason I suspect is because I'm only using one pin to read 40 bits of data (which I suppose I could do).

 

For example;

My vhdl file has the following declared: 

data_in : std_logic_vector (30 downto 0);

 

and in my constraint file;

NET "data_in" LOC = "B4";

 

The file compiles if I read one bit at a time such as "data_in<0>". This means I'm going to have data_in<0> through to data_in<39> and have 40 pins assigned? (which is obviously not correct). Is there a way around it?

 

Kind regards

0 Kudos
6 Replies
Scholar joelby
Scholar
5,532 Views
Registered: ‎10-05-2010

Re: Constraint file error when reading from breadboard

If you define data in as a 31 (or 40) bit vector, you'll need to define all 31 (or 40) nets in your UCF.

 

You can't read 40 bits of data using only one pin unless you do so serially. However this will require additional logic to clock incoming bits into a shift register or similar, and this can't be inferred automatically by the tools. Is the sensor using an SPI/I2C interface or something like that?

0 Kudos
Visitor vipulreddy
Visitor
5,530 Views
Registered: ‎07-31-2012

Re: Constraint file error when reading from breadboard

Thanks for your reply joelby. The sensor I'm using is just the most basic digital 2-in-1 temperature sensor (bought it from an electronics store, the sensor is called "Grove temperature and humidity sensor") that I have wired onto the breadboard. I have connected the "SIG" line of the sensor to the IO1 port of the breadboard.

Do you have any suggestions as to how I read the values from the sensor? The sensor provides a 40bit data signal (16 bits of humidity + 16bits of temp + 8bits of checksum).
0 Kudos
Instructor
Instructor
5,525 Views
Registered: ‎08-14-2007

Re: Constraint file error when reading from breadboard

Did you get a data sheet with the sensor?  If not do you at least know the part number so

you can search the web for one?  That would describe the data format and what you

need to do to read the sensor.

 

-- Gabor

-- Gabor
0 Kudos
Scholar joelby
Scholar
5,517 Views
Registered: ‎10-05-2010

Re: Constraint file error when reading from breadboard

You should be able to find a complete data sheet for the sensor, but the Seeed Studios page has some good details on how it works. If you look at the waveform figure under "Usage", you'll see that you need to send a signal from the FPGA to the sensor, wait, and then read back data from the sensor, one bit at a time over a single wire. There's some C code below that you can use as a guide for a state machine that will do this.

 

It's not a very complicated task for an experienced HDL designer, but if you're new to FPGAs I would recommend working on a few simple designs until you're confident with finite state machines, tri-state I/O, synchronising asynchronous signals, etc.

 

Visitor vipulreddy
Visitor
5,511 Views
Registered: ‎07-31-2012

Re: Constraint file error when reading from breadboard

Gabor and joelby, thanks for your replies. I did have a look at the information, but I was wondering if there was any other way. Now that you've mentioned that I'll need to read 1 bit at a time in a loop, I guess that's the only way.

Thanks once again.

0 Kudos
Historian
Historian
5,501 Views
Registered: ‎02-25-2008

Re: Constraint file error when reading from breadboard


@vipulreddy wrote:

 Now that you've mentioned that I'll need to read 1 bit at a time in a loop, I guess that's the only way.



A loop is a software construct. You don't read "1 bit at a time in a loop."

 

You need to build a shift register which shifts in the appropriate number of bits. When all bits are shifted in, you have your data word.

----------------------------Yes, I do this for a living.
0 Kudos