How to use the ADC on StartKit?

All technical discussions and projects around startKIT
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Re: How to use the ADC on StartKit?

Postby Folknology » Sat Jan 11, 2014 4:34 pm

Ok heres some dope on the F link check:

When I disable -fxscope in my make file the (data== 0) path is taken and it seems to hang at the first read_sswitch_reg

This indicates some interesting things:

1) The F link seems to be used by xscope when -fxscope is used on the xcc_flags. It's as if the inclusion of xscope functionality already builds in network enablement of the adctile for startkit (remote tile) functionality. This could be perhaps so that xscope can read the adc directly for instance, or it may simply be better to configure the network adc and xscope together.

2) The code sethu provided to configure the switches for remote network adc obviously have a bit of a problem, possibly due to not checking for credit tokens or some such


regards
Al
User avatar
segher
XCore Expert
Posts: 843
Joined: Sun Jul 11, 2010 1:31 am

Postby segher » Sat Jan 11, 2014 5:07 pm

xscope needs to communicate from the app node to the
debug node, so obviously it has to set up some network,
some way. What, how, I don't know.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Postby Folknology » Sat Jan 11, 2014 5:31 pm

Here is the setup from the Startkit XN file BTW:

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" ManuallySpecifiedRouting="true">
  <Type>Board</Type>
  <Name>XMOS startKIT</Name>
  <BoardId>00083C0X</BoardId>
  <Declarations>
    <Declaration>tileref tile[1]</Declaration>
    <Declaration>tileref xscope_tile</Declaration>
    <Declaration>tileref adc_tile</Declaration>
  </Declarations>
  <Packages>
    <Package id="0" Type="XS1-L1A-TQ128">
      <Nodes>
        <Node Id="0" InPackageId="0" Type="XS1-L8A-64" Oscillator="24MHz" SystemFrequency="500MHz" RoutingId="32769">
          <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"/>
          </Tile>
          <RoutingTable>
            <Bits>
              <Bit number="0" direction="0"/>
              <Bit number="15" direction="0"/>
            </Bits>
            <Links>
              <Link name="XLF" direction="0"/>
            </Links>
          </RoutingTable>
        </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>
  <Nodes>
    <Node Id="1" Type="device:" routingId="0x8000" RoutingId="32768" Reference="xscope_tile">
      <Service Id="0" Proto="xscope_host_data(chanend c);">
        <Chanend Identifier="c" end="3"/>
      </Service>
    </Node>
    <Node Id="2" Type="device:" routingId="0x0" RoutingId="0" Reference="adc_tile">
      <Service Id="0" Proto="startkit_adc(chanend c);">
        <Chanend Identifier="c" end="0xff"/>
      </Service>
    </Node>
  </Nodes>
  <Links>
    <Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
      <LinkEndpoint NodeId="0" Link="XLF"/>
      <LinkEndpoint NodeId="1" Chanend="1"/>
    </Link>
    <Link>
      <LinkEndpoint NodeId="1"/>
      <LinkEndpoint NodeId="2"/>
    </Link>
  </Links>
  <JTAGChain>
    <JTAGDevice NodeId="0"/>
  </JTAGChain>
</Network>
regards
Al
User avatar
segher
XCore Expert
Posts: 843
Joined: Sun Jul 11, 2010 1:31 am

Postby segher » Sat Jan 11, 2014 5:56 pm

Different node ids, different link used, different link encoding,
different link speed. Lovely ;-)
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Postby Folknology » Mon Jan 13, 2014 1:20 pm

Ok a quick summary :

Currently we can only seem to use the ADC when -fxscope is enabled as the code provided in this link is inoperable without it

I think we need someone at Xmos with the proper insights to the network adc operation and xscope to clarify this situation and let us know how we should proceed.


Awaiting a response..

regards
Al
Tener
Newbie
Posts: 1
Joined: Tue Jan 14, 2014 8:44 pm

Postby Tener » Thu Jan 16, 2014 8:50 am

Does anyone know if XMOS is somehow working on this issue? I would really like to use the ADCs on startkit :-) and the way it is now I'm not sure I can make it run.
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Postby XMatt » Fri Jan 17, 2014 2:56 pm

The ADC support at the moment is as follows,

1. Running from JTAG requires -fxscope currently, when we post the updated example to github which is documented we will attempt to address this. The xSCOPE link on startKIT is shared for ADC traffic and the -fxscope option enables this link in the application and does the setup. This should cause you no issues when running from JTAG.

2. The OTP boot code on tile 1 (the application tile) enables the xCONNECT link correctly for operation when booting from flash to allow the setup code in the example to configure the link.

These are the two modes of operation for enabling the ADC on startKIT.

At this time to operate the ADC via JTAG you will need to pass the -fxscope option without going in and manually enabling the correct link with some extra code.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Postby Folknology » Fri Jan 17, 2014 4:15 pm

Thanks for the clarification Matt, that helps explain things a little

Couple of follow up questions if you don't mind:

1) Is the interface going to remain like the current U/A series i.e. like the startkit adaptation I uploaded or will the interface itself change?

2) When the updated examples are are posted on git hub will they just be added into the Startkit examples or as a separate module?

3) Any idea when those examples will be posted?

4) Any idea what the min latency between trigger and reception is likely to be on the Startkit with the final software, and will concurrent use of xscope effect this?

regards
Al
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Postby XMatt » Fri Jan 17, 2014 5:33 pm

1. The example you provided was similar to what we were intending, just providing an init function but using the interface library as you have done.

2. I would expect there will be an app_startkit_adc in startkit examples and a module_startkit_adc, at the moment these are planned to go in the Startkit examples

3. I am just chasing this up at the moment, I would hope by the end of the month.

4. We have not looked at if sharing this link causes any issues when used concurrently for performance as yet. The option is always there to not use xscope and when the app is deployed in flash this is not an issue. The latency figures I will try and get an answer for.
Folknology wrote:Thanks for the clarification Matt, that helps explain things a little

Couple of follow up questions if you don't mind:

1) Is the interface going to remain like the current U/A series i.e. like the startkit adaptation I uploaded or will the interface itself change?

2) When the updated examples are are posted on git hub will they just be added into the Startkit examples or as a separate module?

3) Any idea when those examples will be posted?

4) Any idea what the min latency between trigger and reception is likely to be on the Startkit with the final software, and will concurrent use of xscope effect this?

regards
Al
dimitris
Active Member
Posts: 37
Joined: Tue Feb 19, 2013 5:07 pm

Postby dimitris » Fri Jan 17, 2014 7:14 pm

Hi everybody,
it's nice to watch this thread!
I was having the same problems as MatCat and Folknology's solution worked for me. Just make sure you add the -fxscope flag in both the debug and release flags

I was expecting an API for the analogue part. Fortunately Folkonology's module brings the whole thing closer to that.
It would be nice if someone could give us more context on why is the whole thing needed! I was expecting that it would be as trivial as writing and reading some registers.

Code: Select all

data[0] = 0x10201;
     write_periph_32(adc_tile, 2, 0x20, 1, data);
This is what I was expecting it would make it run.

I would also appreciate some more insight on the reading of the samples.

Code: Select all

unsigned int samps = inuint(c);
         chkct(c, 1);
How come and this is different from reading a channel.

Folkonogy, I still get some preprocessor erros when I use your module. More specificaly it fails to find the xassert and the debug_print libraries. Removing those and replaycing the printing with standard prints made it work for the time being.

Kind regards,
Dimitris

Who is online

Users browsing this forum: No registered users and 1 guest