Active low strobed port?

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Active low strobed port?

Post by Andy »

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.


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

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.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

Thanks Richard, very useful!
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

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?
User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post by paul »

Are you seeing that on the simulator? The inversion isn't represented on the waveform (not sure why this is...)

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.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

Yep it doesn't seem to be correct on the simulator waveform - should I try it on a scope?
User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post by paul »

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.
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

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).
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

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).
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?)

Edit: I've worked out that port B is pad 169 by trial and error. Are these listed somewhere?
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

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.
Post Reply