cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
syoung
Visitor
Visitor
239 Views
Registered: ‎04-05-2021

Spartan 6 Tristate not working right

Jump to solution

Part in question: Spartan 6 xc6slx45t

Goal: Program microchip Pic 18 with ICSP, data line is a bi-directional but fully driven which requires 0/1/Z states

Issue: Can not get a single pin functioning as a tristate. Even when in Z state the pin maintains its prior output state either 1/0

Originally I found the compiler was optimizing the internal tristate as a pull up/open drain so I changed the module to using 3 separate signals, data output/data input/data direction (output) and using below code in the top module.

external pin <= 'Z' when data_direction = '1' else data_output;

data_input <= external pin;

But while this does fix the warning saying the signal was optimized to a pull up/open drain it does not change the behavior from driving the pin with it's previous output value even though it has been set to 'Z'.

I did try 2 other pins and the pins are all configured as 3.3V LVCMOS. The original pin I tried is tied directly to T22 and the other 2 are tied to P22 and M22. Clock is a 27MHz driven oscillator.

Currently to get the prototype to work I've been using 2 pins, 1 for input and 1 for output with a current limit resistor in between. Everything works fine this way but I don't believe I will have any spare pins to do this on the final design. Any help or guidance would be greatly appreciated.

0 Kudos
1 Solution

Accepted Solutions
syoung
Visitor
Visitor
191 Views
Registered: ‎04-05-2021

Turns out doing the same as I was above except throwing the read section into a clock sync'd process makes it work...

external pin <= 'Z' when data_direction = '1' else data_output;

process(clk_27mhz_1)

begin

if rising_edge(clk_27mhz_1) then

data_input <= external pin;

end if;

end process;

View solution in original post

0 Kudos
3 Replies
bruce_karaffa
Scholar
Scholar
219 Views
Registered: ‎06-21-2017

You could instantiate an IOBUF.  Look for it in the language templates.  While you should be able to infer a tri-state buffer, instantiation should work without question.

syoung
Visitor
Visitor
201 Views
Registered: ‎04-05-2021

I tried this but unfortunately it did not work. The pin was held to ground during states where it was set to high Z, or in this case when the port T of IOBUF was a 1.

I commented out the 2 lines I listed above and added the IOBUF instantiation in their place as I already had the correct signals in use.

I am not familiar with the 3 generics however which may be part of the problem, I just left them as the values listed in the IOBUF template.

DRIVE => 12
IOSTANDARD => "DEFAULT"
SLEW => "SLOW"

Is there something that needs changed here perhaps?

0 Kudos
syoung
Visitor
Visitor
192 Views
Registered: ‎04-05-2021

Turns out doing the same as I was above except throwing the read section into a clock sync'd process makes it work...

external pin <= 'Z' when data_direction = '1' else data_output;

process(clk_27mhz_1)

begin

if rising_edge(clk_27mhz_1) then

data_input <= external pin;

end if;

end process;

View solution in original post

0 Kudos