Is there a way to configure a strobed port as active low? I can't see any reference in the documentation.
I'm having trouble getting the Chip Enable (active low) timing correct on a 25MHz SPI protocol.
Active low strobed port?
-
- Respected Member
- Posts: 279
- Joined: Fri Dec 11, 2009 1:34 pm
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
You can use set_port_inv() (defined in xs1.h) to invert a 1-bit port.
If you invert a ready in port it will cause data to be sampled when the ready in signal is low instead of high. If you invert a port used as a ready out then it will be driven low while data is output.
If you invert a ready in port it will cause data to be sampled when the ready in signal is low instead of high. If you invert a port used as a ready out then it will be driven low while data is output.
-
- Respected Member
- Posts: 279
- Joined: Fri Dec 11, 2009 1:34 pm
Thanks Richard, very useful!
-
- Respected Member
- Posts: 279
- Joined: Fri Dec 11, 2009 1:34 pm
Richard, this function doesn't seem to be having the desired effect. It drives the pin high for a while, then low for a period before being driven high as normal along with the data output.
Have you any example code using the strobed master?
Have you any example code using the strobed master?
-
- XCore Addict
- Posts: 169
- Joined: Fri Jan 08, 2010 12:13 am
Are you seeing that on the simulator? The inversion isn't represented on the waveform (not sure why this is...)
Cheers,
Cheers,
Paul
On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
-
- Respected Member
- Posts: 279
- Joined: Fri Dec 11, 2009 1:34 pm
Yep it doesn't seem to be correct on the simulator waveform - should I try it on a scope?
-
- XCore Addict
- Posts: 169
- Joined: Fri Jan 08, 2010 12:13 am
Yeah, that might be a good idea... it should be inverted coming out the hardware.
Paul
On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
As far as the simulator is concerned the inversion happens between the port and the pads. The VCD shows the port as having the non-inverted value. If you trace the the pads you should see the value after the inversion is applied (i.e. active low).
-
- Respected Member
- Posts: 279
- Joined: Fri Dec 11, 2009 1:34 pm
Richard, I'm having problems tracing the correct pad on the waveform viewer. What's the relationship between the port and pad number? (is there one?)richard wrote:As far as the simulator is concerned the inversion happens between the port and the pads. The VCD shows the port as having the non-inverted value. If you trace the the pads you should see the value after the inversion is applied (i.e. active low).
Edit: I've worked out that port B is pad 169 by trial and error. Are these listed somewhere?
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
The port to pin mapping is listed in the datasheet for the package (XS1-G4 512BGA Datasheet, XS1-L1 128TQFP Datasheet, etc.). You can also get the simulator to dump out the mapping using the --dump-ios mapping. You must supply an executable as it reads the package information from the .xe file.