Wi-Fi sliceCARD and ports on startKIT Topic is solved

All technical discussions and projects around startKIT
User avatar
aclassifier
Respected Member
Posts: 507
Joined: Wed Apr 25, 2012 8:52 pm

Wi-Fi sliceCARD and ports on startKIT

Post by aclassifier »

Pins not found
In the examples I see where the Wi-Fi sliceCard is not used with the startKIT I see that

Code: Select all

on tile[0]: wifi_tiwisl_ctrl_ports_t tiwisl_ctrl =
{
  XS1_PORT_4E, // nCS - Bit0, Power enable - Bit1
  XS1_PORT_1L, // nIRQ
};
in Main.xc in app_tiwisl_simple_webserver. I have found no example with it running in the startKIT [1].

My problem is that I can't see that [4E0..4E3] or [X0D26,X0D27,X0D32,X0D33] are availaible on the Wi-Fi sliceCard. It's [4C0,4C1,4D0,4D1] or [X0D14,X0D15,X0D16,X0D17] that are available on PCIe [B6,B7,B9,B11]. See attached files for an overview.

What am I missing?

[1] http://www.xcore.com/forum/viewtopic.ph ... lit=WI+FI#

1-bit port in set of 32 bit port?

I think not: that a pin like X0D52 that only is mapped as part of XS1_PORT_32A [32A3] may be type cast into a 1-bit port? I'm sure they are hard wired? In other words I have to use standard bit handling?

Not touching other pins also defined in a bigger set

A last point: how do I make sure that this bit handling will not fiddle with the other bits that are not only mapped onto XS1_PORT_32A but also like XS1_PORT_4A or XS1_PORT_1E - in other modules? Is there a general scheme for modules that use some of the pins but not all? I have read the literature [2], [3] but probably missed the forest for the trees. (I also mention this question at "Atomicity of handling of port pins" at https://www.xcore.com/forum/viewtopic.php?f=26&t=5096)

Update 6Jan2017: I have discovered pin group "precedence". See https://www.xmos.com/support/tools/libr ... nent=14810. It solves my question.

[2] http://www.xmos.com/download/private/XS ... 1373A).pdf
[3] https://www.xmos.com/download/private/I ... 2738B).pdf
You do not have the required permissions to view the files attached to this post.
Last edited by aclassifier on Thu Dec 29, 2016 7:28 pm, edited 1 time in total.
View Solution
henk
Verified
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Hi

Many questions, not sure I can answer all of them.

N-bit ports, with N greater than 1. These ports can only be used by one task at any one time, and are meant for inputting and outputting parallel data. In projects where you have no parallel data and a need for more 1-wire signals, you can use a 4-bit port to drive multiple one-wire signals simultaneously; but they should all come from the same task. Usually one uses slow signals (such as Reset, Chip-Select, or Power-Enable) and put them on the shared port, as you normally drive many only whilst resetting. If there is a signal that varies, you will typically remember the state of all four wires in a variable, change that variable, and drive that variable every time you want to update a bit. Finally, you cannot generally use a few bits for input and a few bits for output; with the exception of signals that are open-drain, in which case you can do it with an xCORE200 - hence you may find I2C on a 4-bit port.

Wifi, Startkit, and Slices - if memory serves me right, then the stArtKIT has a slice connector with the correct types of ports (4-bit, 1-bit) all along it to make it a proper slice connector, but different actual ports. So, rather than using 4E it may have used 4C. This is because of the ports that were available on the chip used. You may need to remap any software to make them use the right port, i.e., hold the startKIT map next to the slicekit map, and check which ones are different.

Cheers,
Henk

I just checked - compare page 4 of <https://www.xmos.com/download/private/s ... l(1.1).pdf> with pages 18&19 of <https://www.xmos.com/download/private/s ... l(1.0).pdf>; you will notice it uses a different set of 1- and 4-bit ports; but they are all 1- and 4-bit ports so each slice can be mapped, just by editing the code that sets it up, or by editing the XN file.
User avatar
aclassifier
Respected Member
Posts: 507
Joined: Wed Apr 25, 2012 8:52 pm

Post by aclassifier »

henk wrote:I just checked - compare page 4 of <https://www.xmos.com/download/private/s ... l(1.1).pdf> with pages 18&19 of <https://www.xmos.com/download/private/s ... l(1.0).pdf>; you will notice it uses a different set of 1- and 4-bit ports; but they are all 1- and 4-bit ports so each slice can be mapped, just by editing the code that sets it up, or by editing the XN file.
Thanks again, Henk - also for the first points! About the last point, it is, I guess, what I have also found out, and was the basis of the question (see the attached documents, where the layouts of Wi-Fi sliceCard and startKIT are side by side - and it doesn't match what I see in the code).

I just don't get how any mapping (in code or in the XN file) may change the layout on the Wi-Fi sliceCard. In the code I see "XS1_PORT_4E, // nCS - Bit0, Power enable - Bit1" (A17, A18, no LEDs there), but on the layout on the Wi-Fi sliecCard they are routed to B6 and B7.

I have measured and inspected on the Wi-Fi sliceCARD A17 and A18 are not connected to anything, just as the diagram says. How can the code say so? I must have found the wrong code or misread completely? What am I missing?
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi. Let me take a stab at this.

You will need 2 key documents for this review:

1) StartKit Hardware Manual

https://www.xmos.com/download/private/s ... 1.3%29.pdf

page 4

Image

2) WIFI SliceKit Schematic download:

https://www.xmos.com/support/boards?product=15833
* last download URL on this webpage contains the schematics

Image

Using the schematic for the WIFI Slicekit, review the PCI Express fingers that allow interfacing with this circuit board. The pinout.rst file (PIN column) offers the relevant and juicy details.

Code: Select all

XA-SK-WIFI-TIWISL Functional Pins
+++++++++++++++++++++++++++++++++

This table shows the port mapping for each of the Slice Card Signal IO, and the Slicekit Slot connector pin it is located on.

=================== ========= ======== ======== ======== ====== ===============================
Function            STAR      TRIANGLE SQUARE   CIRCLE   PIN    Description
=================== ========= ======== ======== ======== ====== ===============================
SPI_DATAIN          1C        1K       1C       1K       B10    SPI Interface to WIFI module
SPI_CLK             1B        1J       1B       1J       A8     SPI Interface to WIFI module
SPI_DATAOUT         1G        1I       1G       1I       B15    SPI Interface to WIFI module
SPI_IRQ#            1L        1F       1L       1F       A15    Interrupt from WIFI module
SPI_CS#             4A0       4E0      4A0      4E0      B6     WIFI Module Chip Select
PWR_EN              4A1       4E1      4A1      4E1      B7     WIFI Module Power Enable
                    4A2       4E2      4A2      4E2      A6     
                    4A3       4E3      4A3      4E3      A7     
LED0                4B0       4F0      4B0      4F0      B9     User LED
LED1                4B1       4F1      4B1      4F1      B11    User LED
                    4B2       4F2      4B2      4F2      A9     
                    4B3       4F3      4B3      4F3      A11    
                    8B0       8D0      8B0      8D0      B12    
                    8B1       8D1      8B1      8D1      B13    
                    8B2       8D2      8B2      8D2      B17    
                    8B3       8D3      8B3      8D3      B18    
=================== ========= ======== ======== ======== ====== ===============================
This document states that if you seat the WIFI slice board into the STAR slot of the XMOS SLICEKIT (not StartKit), then:

SPI_DATAIN will map to 1C port pin. The 1 prefix clarifies that the interface port is "1 Bit" in width.

and so on till we reach:

SPI_CS# which will map to 4A0. The 4 prefix clarifies that the interface port is a 4 bit port and this pin will be a weight of bit # 0 if seated in the STAR slot.

If this PCB is moved to the TRIANGLE slot then the next column of values will apply and your code must match the mappings else your will be "shooting blanks" and not chatting with the hardware.

Now the StartKit details....

Trace where each PCI Express pins from the WIFI Slice board land on the StartKit PCIe slot map shown on page 4.

Code: Select all


(SPI_DATAIN) B10 on the PCIe (male finger) -> will map to StartKit slot pin P1K0 (X0D34 on CPU).
* port is 1 Bit wide and you can use Bit 0 of Port K to communicate with this pin

(SPI_CLK) A8 on the PCIe (male finger) -> will map to StartKit slot pin P1J0 (X0D25 on CPU).
* port is 1 Bit wide and you can use Bit 0 of Port J to communicate with this pin

(SPI_DATAOUT) B15 on the PCIe (male finger) -> will map to StartKit slot pin P1I0 (X0D24 on CPU).
* port is 1 Bit wide and you can use Bit 0 of Port I to communicate with this pin

(SPI_IRQ#) A15 on the PCIe (male finger) -> will map to StartKit slot pin P1L0 (X0D35 on CPU).
* port is 1 Bit wide and you can use Bit 0 of Port L to communicate with this pin

(SPI_CS#) B6 on the PCIe (male finger) -> will map to StartKit slot pin P4C0 (X0D14 on CPU).
* port is 4 Bit wide and you can use Bit 0 of Port C to communicate with this pin
NB: Being a 4 bit wide port, any R/W with this port will affect all 4 bits of port C

(PWR_EN) B7 on the PCIe (male finger) -> will map to StartKit slot pin P4C1 (X0D15 on CPU).
* port is 4 Bit wide and you can use Bit 1 of Port C to communicate with this pin
NB: Being a 4 bit wide port, any R/W with this port will affect all 4 bits of port C

Pins A6 (P4C2) & A7 (P4C3) on the PCIe fingers for this WIFI Slice board are NOT USED.

This means that P4C2 and P4C3 bit values are no care for this WIFI Slice coding.


(LED0) B9 on the PCIe (male finger) -> will map to StartKit slot pin P4D0 (X0D16 on CPU).
* port is 4 Bit wide and you can use Bit 0 of Port D to communicate with this pin
NB: Being a 4 bit wide port, any R/W with this port will affect all 4 bits of port C

(LED1) B11 on the PCIe (male finger) -> will map to StartKit slot pin P4D1 (X0D17 on CPU).
* port is 4 Bit wide and you can use Bit 1 of Port D to communicate with this pin
NB: Being a 4 bit wide port, any R/W with this port will affect all 4 bits of port C

Pins A9 (P4D2) & A11 (P4D3) on the PCIe fingers for this WIFI Slice board are NOT USED.

This means that P4D2 and P4D3 bit values are no care for this WIFI Slice coding.

Next, download the example code for the WIFI Slice board use and alter the source code to map to those for the StartKit. Alter the target board to be the StartKit as well for the makefile.

These changes are informing the source code that the respective new port mappings on the CPU will allow for communication with the WIFI Slice board.

Recommend to:

a) make the relevant changes to target the StartKit and compile and test. Should work without pain.

b) If no go, then focus to blink the 2 x LEDs on board the WIFI Slice board to be confident that you are chatting with the proper hardware mappings.

The XMOS CPUs are large, fast GPIO pins which can be shuffled around to suit most of your needs. You are not tied down to specific port pins for use of the WIFI Slice board as shown in the SliceKit.

It is very easy to lose your way with the many XMOS mappings and translations but is also fun and hopefully rewarding when it is done right. Hope this helps.

Kumar

PS: The WIFI Slice web page on the XMOS website contains a link to the Ethernet Slice board which is incorrect.

sliceKIT daughtercard port mappings

* do not see the need for the XA-SK-ETH100 Ethernet Slice board document for the WIFI Slice board
User avatar
aclassifier
Respected Member
Posts: 507
Joined: Wed Apr 25, 2012 8:52 pm

Post by aclassifier »

mon2 wrote: ...
Next, download the example code for the WIFI Slice board use and alter the source code to map to those for the StartKit. Alter the target board to be the StartKit as well for the makefile.
...
a) make the relevant changes to target the StartKit and compile and test. Should work without pain.
..
It is very easy to lose your way with the many XMOS mappings and translations but is also fun and hopefully rewarding when it is done right. Hope this helps.
Thanks a lot, Kumar! What started this on my part was that I had done the mappings (see my attached documents) and downloaded the code - in order to verify (again) that I didn't crash with my other pins. Then I couldn't imagine that XMOS either 1) hadn't made a generic port mapping that was correct for all or 2) hadn't made ifdefs of the Wi-Fi sliceCard's possible use on all their boards or 3) had assumed that I understood that I had to modify the code myself, which is OK, but it's not ok to be so long after it.

I must study your post to understand how empty PCIe pins A17 and A18 might possibly be mapped correctly for the Wi-Fi sliceCard to be used at all. It's Wi-Fi, but not that Wif-Fi?! I need to do that next year! Have a happy new year!
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hello again. You are quite welcome. I know I will not be able to rest till you have this working :)

Was confused on why you are referencing the A17 and A18 port pins. Now believe I understand the confusion.

Here are more comments:

1) A17 and A18 pins on the PCIe fingers are not used for this expansion card.

2) However, also see that

A17 = 4E0
A18 = 4E1

You are most likely noting this relationship due to the original source code for the WIFI Slice board ? The 4E port group is used by the WIFI example code and is due to the recommended SliceKit use. That is, for the SliceKit, the demo was requesting the use of the TRIANGLE or CIRCLE slot ? That is the reason for the 4E port mapping.

This definition must change for the StartKit.

Having said this, do not be concerned about what the original example code is using. Simply review the WIFI slice schematic and their physical pins used in the design. Then trace the same pins and review where they land on the StartKit. It is those pins only that must be applied in your revised source code.

In summary, you are informing the XMOS CPU to use the port pins which are present on the StartKit (rather than the SliceKit) - that is all. XMOS was quite clever to maintain the same port pin widths for most products so it should be relatively simple to alter the original source code to support the StartKit for this WIFI Slice.

Try the following changes for your source code:

Code: Select all

//::Ports Start
on tile[0]: spi_master_interface tiwisl_spi =
{
  XS1_CLKBLK_1,
  XS1_CLKBLK_2,
  XS1_PORT_1K, // MOSI
  XS1_PORT_1J, // CLK
  XS1_PORT_1I, // MISO
};

on tile[0]: wifi_tiwisl_ctrl_ports_t tiwisl_ctrl =
{
  XS1_PORT_4C, // nCS - Bit0, Power enable - Bit1 (for StartKit)
  XS1_PORT_1L, // nIRQ (for StartKit)
};

on tile[1]: r_i2c p_i2c =
  {     XS1_PORT_1F,  // this must be for some I2C device but not used on WIFI slice
	 XS1_PORT_1B, // this must be for some I2C device but not used on WIFI slice
		1000 };
on tile[0]: port p_led=XS1_PORT_4D; // for StartKit
//on tile[0]: port p_button=XS1_PORT_4C; // need time to review this definition for StartKit use
//::Ports End
On the StartKit, all user ports are on Tile 0. Tile 1 is for debugging. Often get the MISO and MOSI pins reversed but do test as posted above. If mapped correctly, then the XMOS SPI master code should be able to chat with the WIFI module. If not, swap the definitions for the MISO & MOSI pins. For now, mask out the use of the push button so you can validate that the WIFI slice is able to be initialized by the StartKit.

Happy New Year to you and all XMOS users !
User avatar
aclassifier
Respected Member
Posts: 507
Joined: Wed Apr 25, 2012 8:52 pm

Post by aclassifier »

Now I got it! Since I came to the startKit not via the sliceKIT core board it took you two to point me to the fact that there are four kind of mapping of pins with four PCIe connectors (called STAR, SQUARE, TRIANGLE and CIRCLE). And alas, there is no general way to #define these in the code. And even if the startKIT has PCIe the mapping is like none of the four. Pin budgeting is difficult. So, here's a summary of the above, with pin PCIe B6 as an example (XC coding was not in my original question):

Code: Select all

From https://www.xmos.com/download/private/sliceKIT-Hardware-Manual(1.0).pdf:
2.10.1 STAR
    B6 X0D2 P4A0 P8A0 P16A0 P32A20
2.10.2 SQUARE
    B6 X1D2 P4A0 P8A0 P16A0 P32A20
2.10.3 TRIANGLE
    B6 X0D26 P4E0 P8C0 P16B0 (*)
2.10.4 CIRCLE 
    B6 X1D26 P4E0 P8C0 P16B0 (*)
(*) This is the code in Main.xc in app_tiwisl_simple_webserver: XS1_PORT_4E 

From my starting question attachment #1 (2016 12 29 startKIT connections.pdf)
and in comments above:
startKIT
    B6 X0D14 P4C0 P8B0 P32A28 (*)
(*) Meaning XC remapping is necessary and makes sense
It's a strange library/module that needs a git branch to define these matters! Has XMOS done their homework?

I'll edit if any of this is not 100% correct. Please advice!

I have refered to this here (will add a summary): http://www.teigfam.net/oyvind/home/tech ... n_startkit