Hi all,
In my application, one part of what I need to achieve is to echo the state of an input pin (well, several input pins in fact) to (several) output pins. The mapping between input and output pins will occasionally change over time. At the moment I do this with a dedicated thread that waits for changes to the input pins, performs the necessary mapping, and writes to the output pins. However, I am wondering if there is any way I can configure the pins in hardware to do this automatically without requiring an actual event-driven loop in software. Reading through the hardware documentation for the IO ports, I couldn't see any way of doing this, but I wonder if anybody has any ideas? Just about all the "special features" seem to be useful features targeted at serial IO, and I couldn't imagine any devious way to use e.g. clocking features to achieve what I want. Can anybody suggest how I might achieve what I want?
Thanks
Jonny.
Echoing one pin to another
-
- Member
- Posts: 15
- Joined: Tue Aug 20, 2013 10:01 am
-
- Member
- Posts: 15
- Joined: Tue Aug 20, 2013 10:01 am
Or, looking at it another way, can anyone recommend a simple external chip or add-on that would serve as a sort of digital, programmable patch board, i.e. the xmos can instruct it as to what mappings/shufflings it should apply from e.g. 16 digital inputs to 8 digital outputs? (I'm not even sure what the correct technical term for such a chip is, although I feel sure it must exist)
[edit: I think I'm talking about something like this https://www.bucek.name/pdf/4512.pdf , but I'd want to map from 16 in to 8 out(!) so, to keep the number of pins from being insanely high, the mapping would need to be programmable rather than the direct 3-bit selector used in that one]
[edit: I think I'm talking about something like this https://www.bucek.name/pdf/4512.pdf , but I'd want to map from 16 in to 8 out(!) so, to keep the number of pins from being insanely high, the mapping would need to be programmable rather than the direct 3-bit selector used in that one]
-
- Respected Member
- Posts: 365
- Joined: Wed May 31, 2017 6:55 pm
I think what you're after is called a crosspoint switch. There are lots of these devices available, and many may be simple analog switches rather than digital. Have a look at what's out there and see if anything suits.
As far as I know there isn't a way to do this directly in the XMOS hardware.
As far as I know there isn't a way to do this directly in the XMOS hardware.
-
- Member
- Posts: 15
- Joined: Tue Aug 20, 2013 10:01 am
Ah that's great - thankyou! I would probably never have figured out the correct search term otherwise. That sounds like exactly what I was looking for.
-
- Respected Member
- Posts: 365
- Joined: Wed May 31, 2017 6:55 pm
If that doesn't work, you could consider using a 64k x 8 RAM (which would need a fair amount of initialisation) or a FPGA configured as eight 16-to-1 multiplexers, with something like a 32-bit shift register for the control input.
-
- XCore Expert
- Posts: 580
- Joined: Thu Nov 26, 2015 11:47 pm
If you clocked the IO it would be pretty straightforward to use buffered input and output ports to do it I would think. Depending on your RAM availability and propagation delay requirements you could use some kind of optimised lookup table based on CousinItt's suggestion.
-
- Member
- Posts: 15
- Joined: Tue Aug 20, 2013 10:01 am
"If you clocked the IO it would be pretty straightforward to use buffered input and output ports to do it I would think."
Could you tell me a little more about what you mean here? Obviously if I read and write to the ports from a loop then I can do what I want (with no need for clocking), but it sounds as if you have something more complex in mind - perhaps eliminating the need for polling that I am trying to get rid of?
Could you tell me a little more about what you mean here? Obviously if I read and write to the ports from a loop then I can do what I want (with no need for clocking), but it sounds as if you have something more complex in mind - perhaps eliminating the need for polling that I am trying to get rid of?
-
- XCore Expert
- Posts: 580
- Joined: Thu Nov 26, 2015 11:47 pm
Actually I think I was confused, it probably wouldn't save you anything. Sorry.