Problem Flashing on custom Board

Technical questions regarding the XTC tools and programming with XMOS.
JoeD
Junior Member
Posts: 7
Joined: Tue Aug 12, 2014 3:50 pm

Problem Flashing on custom Board

Post by JoeD »

Hi,

I've got a custom Board with an XS1-A16A-128.
The Layout and peripherials is pretty close to the StartKit.

Debuging Programs works fine, but when I try to use the Flash I get the following Error:

Code: Select all

xflash: Error: F03096 Node "1" is configured to boot from SPI but no suitable device was found.
I'm running out of ideas what could cause this error and how to fix it.

Thanks in advance,
JoeD

I've build a custom XN File for my board. It is based on the XN-File of the XS1-A16A.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
  <Type>Device</Type>
  <Name>SensorBoard Device</Name>

  <Declarations>
    <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref analog_tile</Declaration>
  </Declarations>

  <Packages>
    <Package ID="0" Type="XS1-AnA-128-FB217">
      <Nodes>
      
        <Node Id="0" InPackageId="0" Type="XS1-L8A-64" Oscillator="24MHz" SystemFrequency="500MHz">
          <Boot>
            <Source Location="SPI:bootFlash"/>           
          </Boot>
          <Tile Number="0" Reference="tile[0]">
            <Port Location="XS1_PORT_1A" Name="PORT_SPI_MISO"/>
        	<Port Location="XS1_PORT_1B" Name="PORT_SPI_SS"/>
        	<Port Location="XS1_PORT_1C" Name="PORT_SPI_CLK"/>
        	<Port Location="XS1_PORT_1D" Name="PORT_SPI_MOSI"/>
        	<Port Location="XS1_PORT_8A" Name="PORT_LED_SW"/>          
          </Tile>
        </Node>
        
        <Node Id="1" InPackageId="1" Type="XS1-L8A-64" Oscillator="24MHz" SystemFrequency="500MHz">
          <Tile Number="0" Reference="tile[1]"/>
        </Node>
        
        <Node Id="2" InPackageId="2" Type="periph:XS1-SU" Reference="analog_tile">
          <Service Proto="xs1_su_adc_service(chanend c)">
            <Chanend Identifier="c" end="2" remote="31"/>
          </Service>
        </Node>
        
      </Nodes>
      
    </Package>
  </Packages>
  
  <ExternalDevices>
    <Device NodeId="0" Tile="0" Class="SPIFlash" Name="bootFlash" Type="S25FL204K">
      <Attribute Name="PORT_SPI_MISO" Value="PORT_SPI_MISO"/>
      <Attribute Name="PORT_SPI_SS" Value="PORT_SPI_SS"/>
      <Attribute Name="PORT_SPI_CLK" Value="PORT_SPI_CLK"/>
      <Attribute Name="PORT_SPI_MOSI" Value="PORT_SPI_MOSI"/>
    </Device>
  </ExternalDevices>
  
  <Links>
    <Link Encoding="5wire" Delays="0,1">
      <LinkEndpoint NodeId="0" Link="XLG"/>
      <LinkEndpoint NodeId="1" Link="XLF"/>
    </Link>
    <Link Encoding="5wire" Delays="0,1">
      <LinkEndpoint NodeId="0" Link="XLH"/>
      <LinkEndpoint NodeId="1" Link="XLE"/>
    </Link>
    <Link Encoding="5wire" Delays="0,1">
      <LinkEndpoint NodeId="0" Link="XLE"/>
      <LinkEndpoint NodeId="1" Link="XLH"/>
    </Link>
    <Link Encoding="5wire" Delays="0,1">
      <LinkEndpoint NodeId="0" Link="XLF"/>
      <LinkEndpoint NodeId="1" Link="XLG"/>
    </Link>
    <Link Encoding="5wire">
      <LinkEndpoint NodeId="0" Link="XLC" Delays="52clk,52clk"/>
      <LinkEndpoint NodeId="2" Link="XLC" Delays="1clk,1clk"/>
    </Link>    
  </Links>
  
  <JTAGChain>
     <JTAGDevice NodeId="0"/>
     <JTAGDevice NodeId="1"/>
     <JTAGDevice NodeId="2"/>
  </JTAGChain>
 
</Network>

The Makefile:

Code: Select all

# The TARGET variable determines what target system the application is
# compiled for. It either refers to an XN file in the source directories
# or a valid argument for the --target option when compiling
TARGET = SensorBoard

# The APP_NAME variable determines the name of the final .xe file. It should
# not include the .xe postfix. If left blank the name will default to
# the project name
APP_NAME = Sensor-Test-Modul

# The USED_MODULES variable lists other module used by the application.
USED_MODULES = 

# The flags passed to xcc when building the application
# You can also set the following to override flags for a particular language:
# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS
# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to
# xcc for the final link (mapping) stage.
XCC_FLAGS_Debug = -O0 -g -lflash
XCC_FLAGS_Release = -O2 -g

# The XCORE_ARM_PROJECT variable, if set to 1, configures this
# project to create both xCORE and ARM binaries.
XCORE_ARM_PROJECT = 0

# The VERBOSE variable, if set to 1, enables verbose output from the make system.
VERBOSE = 0

XMOS_MAKE_PATH ?= ../..
-include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common
Test Program:

Code: Select all

/*
 * Sensor-Test-Modul.xc
 *
 *  Created on: 01.09.2014
 *      Author: DJ32180
 */

//#include <stdio.h>
#include <timer.h>
#include <xs1.h>
#include <print.h>

port pLED1           = XS1_PORT_8A;

[[combinable]]
void flashing_led_task3(port p, int delay_in_ms) {
  timer tmr;
  unsigned t;
  // Convert delay from ms to 100Mhz timer ticks
  const int delay_ticks = delay_in_ms * 100000;
  // The value we are going to output
  unsigned val = 1;
  //printf("Hello World3\n");

  // read the initial timer value
  tmr :> t;
  while (1) {
    select {
    // This case will event when the timer moves past (t + delay_ticks) i.e
    // delay_ticks after when we took the timestamp t
    case tmr when timerafter(t + delay_ticks) :> void:
      //val++;
      val = val << 1;
      if (val>0xF) val = 1;
      p <: (0xF - val) ;
      printstr("Value: ");
      printuintln(val);
      // set up the next event
      t += delay_ticks;
      break;
    }
  }
}

int main() {
  flashing_led_task3(pLED1, 100);
  return 0;
}


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

What are your mode pin settings?

It looks like the tool is claiming that your device is setup so that each tile expects it's own boot SPI - which would be mode 1,1,1 ( for mode pins 4,3,2 - see figure 7, of section 9 of the A16A datasheet)..

https://www.xmos.com/download/public/XS ... 5719H).pdf

Normal booting is mode 0,1,1 where tile 0 boots from the SPI flash and tile 1 boots from tile 0.

The mode pins are internally pulled up, so perhaps you didn't pull down MD4 externally?
JoeD
Junior Member
Posts: 7
Joined: Tue Aug 12, 2014 3:50 pm

Post by JoeD »

Thank you for the quick response.

The documentation of my board states that MODE[4] is connected to GND.
MODE[2] and MODE[3] are joined and connected to the Debug Header. The Pin on the Debug Header has 3.3V.
Is it normal that MODE[2] and MODE[3] are joined?

MODE[1] is floating and MODE[0] connected to GND.

Is it possible to read the State of the Mode Pins from a Register?

____EDIT____
Found out how to read the Register.

Code: Select all

unsigned data = getps(0x03);
returns 0 in normal Mode. I guess this means pretty Normal for booting without flash(from debugger).
Tile0 boots from SPI, Tile1 from channel end 0 via Tile0
May I'm missing the link to boot Tile1 from channel end 0?
User avatar
Ross
XCore Expert
Posts: 968
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

You are missing <boot> from node 1 on your XN:

<Boot>
<Source Location="LINK"/>
</Boot>

I would suggest using SLICEKIT_A16.xn as a starting point, rather than the chip XN files
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Is it possible to read the State of the Mode Pins from a Register?
Looks like you found that! You can also do it from xgdb using this script -https://github.com/xcore/xgdb_scripts.
May I'm missing the link to boot Tile1 from channel end 0?
I think you've cracked it. You are missing bootee and boot source entries in your xn file.

This is from the slicekit-a16.xn file:

Code: Select all

  <Packages>
    <Package ID="0" Type="XS1-AnA-128-FB217">
      <Nodes>
        <Node Id="0" InPackageId="0" Type="XS1-L8A-64" OscillatorSrc="2" SystemFrequency="500MHz">
          <Boot>
            <Source Location="SPI:bootFlash" />
            <Bootee NodeId="1" Tile="0"/>  <<<<<<<<<<THIS!!!
          </Boot>
          <Tile Number="0" Reference="tile[0]">
            <!-- SPI Ports -->
            <Port Location="XS1_PORT_1A" Name="PORT_SPI_MISO"/>
            <Port Location="XS1_PORT_1B" Name="PORT_SPI_SS"/>
            <Port Location="XS1_PORT_1C" Name="PORT_SPI_CLK"/>
            <Port Location="XS1_PORT_1D" Name="PORT_SPI_MOSI"/>
            <Port Location="XS1_PORT_8D" Name="PORT_SPI_DISABLE"/>
          </Tile>
        </Node>
        <Node Id="1" InPackageId="1" Type="XS1-L8A-64" OscillatorSrc="2" SystemFrequency="500MHz">
        <Boot>
          <Source Location="LINK"/>  <<<<<<<THIS!!
        </Boot>
          <Tile Number="0" Reference="tile[1]"/>
        </Node>
        <Node Id="2" InPackageId="2" Type="periph:XS1-SU" Reference="analog_tile" Oscillator="25MHz">
          <Service Proto="xs1_a_adc_service(chanend c)">
            <Chanend Identifier="c" end="2" remote="31"/>
          </Service>
        </Node>
      </Nodes>
    </Package>
  </Packages>

edit - I see Ross got there first
JoeD
Junior Member
Posts: 7
Joined: Tue Aug 12, 2014 3:50 pm

Post by JoeD »

Ok. Those Lines solved the Problem.

Thank you very much!