ina[?|
rjo__
Posts: 2,114
I was fiddling around with my DE2_115/ D5M/P1v. Everything was going swimmingly until I tried to control a P1v pin with a D5M signal through a register and a wire... my first:)
In short, I was expecting a signal to be read at a P1v pin through a Spin command... such as "temp:=ina[mypin]"
ina[mypin] always reads 1.
Thinking that it was me... I started to trace back through my various incantations of the P1v... until I got all the way back to Chip's original.pof file, released on 8/11... and it has the same issue. Boooooooo!!!!
I suspect that tying the pin to ground through a resister is required... but why? and which resister. At last count, I had 52,001 resistors ... but only three where I am right now. These were being used as pullups on something... so probably 1k to 5k(no meter here either and since I am working from a single candle I can't see the little buggers well enough to decode them; no combination of serial or parallel configuration would work... but I got a good laugh out of it:)
???
In short, I was expecting a signal to be read at a P1v pin through a Spin command... such as "temp:=ina[mypin]"
ina[mypin] always reads 1.
Thinking that it was me... I started to trace back through my various incantations of the P1v... until I got all the way back to Chip's original.pof file, released on 8/11... and it has the same issue. Boooooooo!!!!
I suspect that tying the pin to ground through a resister is required... but why? and which resister. At last count, I had 52,001 resistors ... but only three where I am right now. These were being used as pullups on something... so probably 1k to 5k(no meter here either and since I am working from a single candle I can't see the little buggers well enough to decode them; no combination of serial or parallel configuration would work... but I got a good laugh out of it:)
???
Comments
No other cog has that pin set to a high output?
Do you get the same results in assembler?
Ran the same code on my life-time-guaranteed Propeller Bored of Edication ... and it ran fine.
Will have to try it tomorrow... don't have my "toys" with me tonight:)
What pin are you using? Is it a custom assignment or from the DE2 CD assignments?
Short the pin to the ground, then read ina. If you don't find any zero, check block file naming in Quartus settings, it is a mother of all stupid problems with bad assigned pins.
This morning, I repeated what I did at the very end yesterday.
Start Quartus.
Do not select a project.
Start Programmer...
Select Add New File ->P8X32A_DE2_115.pof
This file is from the original download from Chip. This has a date modified = 8/11/2014 ... so it has to be the original.
I set the hardware as usual...Active Serial, USB-Blaster and then selected "Start."
This was successful and I then change the switch on the DE2-115 from prog->run, cycled the power and ran this code from PropellerIDE:...
On a regular P1 board the output was fine:
0
00000000
On the P1v it is:
1
11111111
I shorted one of the pins to ground and then re-ran the code... did not change.
In summary... I didn't use quartus... I used only the Programmer. I used the original design file (.pof) from Chip.
I know that the DE2_115 GPIO works because the D5M camera uses the same GPIO as the unmodified P1v and the camera functions normally.
So we know that pin 30 is working, at least. Maybe add some code to echo data received on pin 31.
Just to restate the problem... for unused pins, the value of INA should be all zeroes.
However, when I use Altera's Programmer to load the .pof from the 8/11/14 release, the values are all ones...
except for pin 30, which is in use and which is occasionally zero.
The code below demonstrates that by first setting dira[..] to 1's and then setting dira[..] to zero's the subsequent values for INA are correct.
However after a fraction of a second the values return to all 1's when they should be all zero's(for pins 0..8).
the output looks like this:
I remember playing with Propeller pins... attaching very short lengths of wire to them to see how sensitive they are to environmental EMF's...They are incredibly sensitive.
I wonder if that has anything to do with this?
Rich
When I use my retromachine capabilities to check these pins:
I have ina[17..8] = 0 - the leds are dark
However if run your code (modified to use pins 15..8 instead of 7..0) I got this
Something is wrong here. Port A works, I use it for many things in my project. Maybe there are something in fullduplexserial object which causes ina to change.
It isn't FDS, because I have run code where the state of the pin(if incorrect) prevents fds from reporting... it gets hung up waiting for the right INA values.
1. I am wondering... since portA is tri-stated, is Quartus adding a weak pullup without our knowledge?
2. Even though the port looks like it shouldn't work... I brought a signal out from my camera( terasic d5m)... the frame valid signal...
to pin 88 on the Parallax AddOn board... I then jumpered this to pin0 and I could get the effective frame rate of the camera.
I have no idea what is going on here:) And I have run out of free time... won't be able to work on it much for the next 2 days.
Many regards.
Once the pins are in the correct state... they don't all go into the wrong state at once and the transitions look somewhat orderly...
they might be completely orderly... I was too tired at the time to pay perfect attention to this detail...
To see this you replace my wait for pin 0 to get to 1, with a repeat loop spitting out INA to FDS until ina[0] ==1 or for some number of repeats that gets you there.
So.... it looks like a decay process. RC? How do we get there from Verilog?
Or an electrostatic process... where the lengths of the physical wires determine the rate of decay?
Or our favorite whipping boy... Quartus:)
Or it could be that I am not an engineer and this is what we should expect from what we have done?
Is this really true? I don't remember ever reading that anywhere. From my experience, I would expect that disconnected input pins would be HIGH, not LOW.
I haven't tried this but in the Quartus pin assignment editor, you can add "input termination" or "passive resistor" or "weak pull-up resistor" entries to pull inputs low or high. The NRES pin has a "weak pull-up resistor" entry in all Altera targets.
If you don't pull inputs low or high, because of the nature of CMOS, it will be whatever it was last set to, until you read it. The way I understand it, CMOS transistors basically draw so little current on the input and have such a high resistance when they're switched off, that what you read from an input transistor (if it has no pull-up or pull-down resistor) is basically the left-over electrons that were still in there from when you last connected it to an output (either by setting DIRA to 1 or by connecting something on the outside).
Whether I'm mistaken or not, I don't think there's anything different with the Verilog for the P1V compared to the P1 when it comes to inputs, you're just seeing side effects because you're not connecting anything to your inputs and expecting a different result from what you're getting. I don't even think there's a way to change this in Verilog because this has nothing to do with logic, it's a side effect of the technology that's used on the FPGA.
Either way, an important point is being made here: I think we should probably add "weak pull-up resistor" entries for all data pins so the inputs are high (not low and not "undefined" as they probably are now) whenever there's nothing attached to them. What do you guys think?
===Jac
Yes, of course all Configurable pins should be set to default to light pullup.
Floating pins on high speed logic is never a good idea, and can have effects that reach wider than the pins.
- and on a test bench, you really do not need more variables in the mix.