Disable SPI interface on USB sliceKIT

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
User avatar
BBenj
Member++
Posts: 21
Joined: Fri Sep 13, 2013 3:00 pm

Disable SPI interface on USB sliceKIT

Post by BBenj »

Hello,

I would like to use the D0-D11 pins of my USB sliceKIT as general I/Os, but I didn't succeed, and I can't find any informations on that.
I can't use the module_slicekit_support as it does not support the U16 slice kit (U16 slicekit use X0D14 & 15 and not X0D42 & 43 as other slicekits).

I tried something very simple (naive?) like:

Code: Select all

#define FLASH_PERIOD 20000000

out port led = XS1_PORT_1C;    // X0D10
out port led2 = XS1_PORT_1G;  // X0D22
out port x0d = XS1_PORT_4C;

int main(void)
{
    // Switch off SPI ? (not working)
    x0d <: 0x1;   // X0D14 high (disable SPI)
    x0d <: 0x3;   // X0D15 high (latch)

  timer tmr;
  int t;
  tmr :> t;

  while (1) {
    led <: 0x1;
    led2 <: 0x1;
    t += FLASH_PERIOD;
    tmr when timerafter(t) :> void;
    led <: 0x0;
    led2 <: 0x0;
    t += FLASH_PERIOD;
    tmr when timerafter(t) :> void;
  }
  return 0;
}
But X0D10 is not flashing (but X0D22 is) so I assume the SPI interface is not disabled.

I also tried to modify the asm code from the slicekit support module but it does not work either.

Am I missing something? If someone has some working code, it would help :-)

Thanks,

Best,
Benj


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Review this thread for details of the required code:

http://www.xcore.com/forum/viewtopic.ph ... tch#p14268

You may have to tweak (ie. specific latch pins and/or XMOS tile for the latch control for the USB Slicekit). If you still have problems, post back and can confirm the full details tomorrow.

Also, recall a thread stating that if you create a project with the respective SliceKit(s) as a target, this piece of code gets automatically embedded into the source code. However, no harm to manually inject into your source code to test. Should work fine.
User avatar
BBenj
Member++
Posts: 21
Joined: Fri Sep 13, 2013 3:00 pm

Post by BBenj »

Thanks for your help.
mon2 wrote:Review this thread for details of the required code:

http://www.xcore.com/forum/viewtopic.ph ... tch#p14268

You may have to tweak (ie. specific latch pins and/or XMOS tile for the latch control for the USB Slicekit). If you still have problems, post back and can confirm the full details tomorrow.
This is exactly what I tried, using the pins X0D14 (SPI EN/DIS, port P4C0) and X0D15 (latch, port P4C1) as specified in the hardware manual of the USB sliceKIT, but it is not working. The pins are not available.
mon2 wrote: Also, recall a thread stating that if you create a project with the respective SliceKit(s) as a target, this piece of code gets automatically embedded into the source code. However, no harm to manually inject into your source code to test. Should work fine.
Not sure about that, my projects (with L16 sliceKIT) always needs the sliceKIT support module to be able to use XD0,1,10,11 pins even if I create a project with a sliceKIT as a target.

Thanks,
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi Benj. Agree that we too manually inject the SPI disable code for the standard SliceKit board for each project to allow us to use the shared SPI pins.

Will check the details on our USB Slicekit upon reaching the office but try the following:

Use the same LED flash code and pivot to use the X0D14 and also X0D15 port pins.

Then launch the project and monitor the logic states of the X0D14 and X0D15 pins - are they toggling / flashing as they should be ? You can probe these pins from various sites on the PCB layout but please review their ref schematic.

ie. R28 is not stuffed so you could use one side of the pad for X0D14 access

and R31 for X0D15 access.

Why you ask ? We wasted 2 days in our original troubleshooting of the same fault with our original XS1 L16 Slicekit only to find that a PCB via was blown (over etched) and not properly allowing for the SPI mux to operate. A life sucking experience. Poor quality PCBs (at least initially).

The USB Slicekits look better but there are still QC issues. The recently purchased USB Slicekit has ALL of the through hole (probe holes) solder plugged. Spent hours removing the holes so we can use as intended. XMOS is claiming they have alerted the assembly house to resolve the fault in the future.

Please confirm if the 2 critical port pins are truly toggling and then focus on the MUX. In the end, the issue has to be logical.
User avatar
xsamc
Active Member
Posts: 55
Joined: Fri Mar 04, 2011 3:38 pm

Post by xsamc »

Hi BBenj,

Support for the USB sliceKIT has been added to module_slicekit_support on GitHub: sc_slicekit_support.
I don't think there has yet been a release made of this module to xmos.com which includes this update.

Hopefully grabbing the code straight from GitHub solves this for you though.

Cheers,
Sam
BBenj wrote:Hello,

I would like to use the D0-D11 pins of my USB sliceKIT as general I/Os, but I didn't succeed, and I can't find any informations on that.
I can't use the module_slicekit_support as it does not support the U16 slice kit (U16 slicekit use X0D14 & 15 and not X0D42 & 43 as other slicekits).
...
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post by Folknology »

I also just tried this on my USB Slicekit by first adding the new version of the module_slicekit_support and it did not work.

I have also tried it by hand (without slice kit support) setting mux control ports manually:

Code: Select all

out port mux = XS1_PORT_4C;
out port osc = XS1_PORT_1A;

int main (void) {
  mux <: 0x01;
  sync(mux);
  mux <: 0x03;
  sync(mux);

	while(1) {
		osc <: 0x1;
		delay_milliseconds(1);
		osc <: 0x0;
		delay_milliseconds(1);
	}
	return 0;

Again no workey unless I change the active port too a non muxed one like 1E so he is not alone, anyone else out there got this working on a USB SliceKit?

regards
Al
User avatar
BBenj
Member++
Posts: 21
Joined: Fri Sep 13, 2013 3:00 pm

Post by BBenj »

Why I didn't read the errata first as I usually do!? >.<
Problem solved, I have a revision 1V2 board, and on this revision the SPI bus switch EN/DIS is connected to X0D16, not X0D14....

Working code:

Code: Select all

on tile[0]: out port mux = XS1_PORT_8B;
mux <: 0x4;
mux <: 0x6;
or with some asm, there are 2 lines to change in the slicekit support module (SLICEKIT-U16)*:

Code: Select all

// Line 44:
ldc r1, 0x4 // SPI disable
// Line 56:
ldc r1, 0x6 // SPI disable + latch
mon2 wrote:The recently purchased USB Slicekit has ALL of the through hole (probe holes) solder plugged.
Mine too, it was a pain to solder some 0.1" headers.

* On github, thanks xsamc

@Folknology: you may also have a "old" revision board, the code above should work.

Thank you guys for your help. Don't forget: always read erratas !! :-P
User avatar
BBenj
Member++
Posts: 21
Joined: Fri Sep 13, 2013 3:00 pm

Post by BBenj »

Actually you can even just do that:

Code: Select all

on tile[0]: out port mux = XS1_PORT_8B;
mux <: 0x6;
Because there is a RC filter between the 2 latches which delay the clock from X0D15.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm
Contact:

Post by Folknology »

BBenj wrote:Why I didn't read the errata first as I usually do!? >.<
Problem solved, I have a revision 1V2 board, and on this revision the SPI bus switch EN/DIS is connected to X0D16, not X0D14....

Working code:

Code: Select all

on tile[0]: out port mux = XS1_PORT_8B;
mux <: 0x4;
mux <: 0x6;
or with some asm, there are 2 lines to change in the slicekit support module (SLICEKIT-U16)*:

Code: Select all

// Line 44:
ldc r1, 0x4 // SPI disable
// Line 56:
ldc r1, 0x6 // SPI disable + latch
mon2 wrote:The recently purchased USB Slicekit has ALL of the through hole (probe holes) solder plugged.
Mine too, it was a pain to solder some 0.1" headers.

* On github, thanks xsamc

@Folknology: you may also have a "old" revision board, the code above should work.

Thank you guys for your help. Don't forget: always read erratas !! :-P
I to have a 1v2 board with header holes soldered (which I need to clear out next week, GRR PITA), however I still can't get the muxed ports working even with your changes....

PS where did you find the errata?

regards
Al
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

http://www.farnell.com/datasheets/1825477.pdf

Section 5.1

Recall reading this a few weeks ago but missed it for this discussion. Note this document is from Farnell website so XMOScom must have of course a local copy with the same details.
Post Reply