../src/led_driver_test.xc:12:8: error: index of array exceeds its upper bound

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
liaz
New User
Posts: 3
Joined: Fri Aug 09, 2019 12:16 pm

../src/led_driver_test.xc:12:8: error: index of array exceeds its upper bound

Postby liaz » Fri Aug 09, 2019 12:23 pm

I'm trying to control the leds with the led driver on the XMOS Vocalfusion stereo board (XVF-3500). However, when i'm assigning the ports to the led driver, the hardware manual shows the ports are on tile 3. So in order to output something on those ports, I use the following code:

#include <platform.h>
#include <xs1.h>
#include <stdio.h>
#include "math.h"

on tile[3]: out port stcp = XS1_PORT_1A;
on tile[3]: out port shcp = XS1_PORT_1B;
on tile[3]: out port data = XS1_PORT_1E;
on tile[3]: out port oe_n = XS1_PORT_1F;

int main(){
stcp <: 0;
shcp <: 0;
data <: 0;
oe_n <: 0;

for (int i=0; i<16; i++){
data <: 0;
shcp <: 0;
shcp <: 1;
}
stcp <: 0;
stcp <: 1;
printf("Done\n");
while(1);
return 0;
}

However when i do this, i get the following errors:

../src/led_driver_test.xc:12:8: error: index of array exceeds its upper bound
on tile[3]: out port stcp = XS1_PORT_1A;
^~~
../src/led_driver_test.xc:13:8: error: index of array exceeds its upper bound
on tile[3]: out port shcp = XS1_PORT_1B;
^~~
../src/led_driver_test.xc:14:8: error: index of array exceeds its upper bound
on tile[3]: out port data = XS1_PORT_1E;
^~~
../src/led_driver_test.xc:15:8: error: index of array exceeds its upper bound
on tile[3]: out port oe_n = XS1_PORT_1F;

Why does it not recognize the tile[] array properly?
The target HW is set to the xCore 200 explorer.
User avatar
mon2
XCore Legend
Posts: 1584
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Fri Aug 09, 2019 2:15 pm

Hi. Tile numbers start from 0 (computer speak :)

For this reason,

tile[0] = first tile
tile[1] = 2nd tile
tile[2] = 3rd tile

so please try again with tile[2] and post your results.
liaz
New User
Posts: 3
Joined: Fri Aug 09, 2019 12:16 pm

Postby liaz » Fri Aug 09, 2019 3:06 pm

I tried this:

on tile[2]: out port stcp = XS1_PORT_1A;
on tile[2]: out port shcp = XS1_PORT_1B;
on tile[2]: out port data = XS1_PORT_1E;
on tile[2]: out port oe_n = XS1_PORT_1F;

but i still get the same errors.
liaz
New User
Posts: 3
Joined: Fri Aug 09, 2019 12:16 pm

Postby liaz » Fri Aug 09, 2019 3:15 pm

Also, when i tried the same code with a new target hardware (one that i installed from the zip file libraries, since the vocalfusion HW is not in the target HW list) i get the following errors.
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 8 guests