Channel/interface limitation between tiles or per function?
Posted: Wed Jun 08, 2016 5:42 am
Is there a limit to the number of channels or interfaces 1 function can manage, or a limit to the number of channels/interfaces operating between tiles?
I'm using an explorerkit and I'm running 1 function to check button inputs by masking the appropriate bits from the 4 bit port and it's correctly identifying a button press(verified using printf()), but the other end of the interface(a [[notification]]) never seems to be called. It's similar in set up to the gpio library.
I check the buttons port on tile[0] using a server task, and the client receives a notification when appropriate. I ran the same code I'm using completely isolated and it worked with the server on tile[0].core[0] and client on tile[1].core[0]. On the actual program the server runs on tile[0].core[3] and the client is running on tile[1].core[0]. I've stopped all other tasks on tile 1 and still get nothing. The task that gets the notification has 13 interfaces being passed into it though with 11 of those from tile 1 to tile 0. If I have to I can write another function and define an interface to control it all across tiles using a single interface(should be 1 channel then? I'm not clear on this) but I don't have time right now. I'm well within the tile constraints but I wasn't sure if there was another unwritten limit that's causing my issue.
Here is the main, in case it helps.
And the server.
And the selects for the events.
I'm using an explorerkit and I'm running 1 function to check button inputs by masking the appropriate bits from the 4 bit port and it's correctly identifying a button press(verified using printf()), but the other end of the interface(a [[notification]]) never seems to be called. It's similar in set up to the gpio library.
I check the buttons port on tile[0] using a server task, and the client receives a notification when appropriate. I ran the same code I'm using completely isolated and it worked with the server on tile[0].core[0] and client on tile[1].core[0]. On the actual program the server runs on tile[0].core[3] and the client is running on tile[1].core[0]. I've stopped all other tasks on tile 1 and still get nothing. The task that gets the notification has 13 interfaces being passed into it though with 11 of those from tile 1 to tile 0. If I have to I can write another function and define an interface to control it all across tiles using a single interface(should be 1 channel then? I'm not clear on this) but I don't have time right now. I'm well within the tile constraints but I wasn't sure if there was another unwritten limit that's causing my issue.
Code: Select all
/*
* Slash RC car.xc
*
* Created on: May 20, 2016
* Author: Maginnovision
*/
#include <gpio.h>
#include "Interfaces.h"
#include "Ports.h"
#include "ThreadDefinitions.h"
int main() {
//Interfaces for reading/writing PWM values
controller_if steering, motor;
//Interfaces for wheel speed data
wheel_speed_if leftwheel, rightwheel;
wheel_handler_if wheels;
//Interfaces for I2C interfaces
i2c_master_if imu_i2c[1];
i2c_slave_callback_if rpi_slave;
path_follower_if path_following[3];
path_follower_data_if path_data;
datalogger_if datalogger;
datalogger_pathing_if datalogger_pathdata;
imu_if imu[3];
input_gpio_if button_if[2];
output_gpio_if led_if[4];
par {
//ESC PWM
on tile[0].core[0]: read_pwm(motor_input, motor, path_following[0], 0);
on tile[0].core[0]: write_pwm(motor_output, motor);
//Steering servo PWM
on tile[0].core[0]: read_pwm(steering_input, steering, path_following[1], 1);
on tile[0].core[0]: write_pwm(steering_output, steering);
on tile[0].core[0]: read_toggle(red_toggle, path_following[2]);
//IMU server and I2C master
on tile[0].core[1]: IMU(imu_i2c[0], imu);
on tile[0]: i2c_master(imu_i2c, 1, imu_scl, imu_sda, 400);
//Datalogging threads
on tile[0].core[2]: Datalogger(rpi_slave, datalogger, datalogger_pathdata);
on tile[0]: i2c_slave(rpi_slave, rpi_scl, rpi_sda, 0x11);
//Button handler and led handler
on tile[0].core[3]: input_gpio_with_events(button_if, buttons_port);
on tile[0].core[4]: output_gpio(led_if, 4, leds_port, null);
on tile[1].core[0]: path_follower(path_following, imu[2], wheels, datalogger, path_data,
led_if[0], led_if[1], led_if[2], led_if[3], button_if[0], button_if[1]);
on tile[1]: pathing_data(path_data, datalogger_pathdata);
//Wheel speed threads and higher level handler
on tile[1].core[1]: wheel_speed(left_wheel_a, left_wheel_b, leftwheel, imu[0]);
on tile[1].core[2]: wheel_speed(right_wheel_a, right_wheel_b, rightwheel, imu[1]);
on tile[1].core[3]: wheels_handler(leftwheel, rightwheel, wheels);
}
return 0;
}
Code: Select all
[[combinable]]
void input_gpio_with_events(server input_gpio_if i[2], in port p)
{
unsigned pval = 0, last_pval = 0;
p :> pval;
while (1) {
select {
case i[int j].input() -> unsigned result: {
result = (pval >> j) & 1;
break;
}
case i[int j].event_seen(): {
delay_milliseconds(50);
break;
}
case p when pinsneq(pval) :> last_pval: {
if ((pval & 0x01) != (last_pval & 0x01) && (pval & 0x01)) i[0].event();
if ((pval & 0x02) != (last_pval & 0x02) && (pval & 0x02)) i[1].event();
pval = last_pval;
break;
}
}
}
}
Code: Select all
case button1.event(): {
button1.event_seen();
current->manual = !current->manual;
led_green.output(current->manual);
robot[0].button();
robot[1].button();
break;
}
case button2.event(): {
button2.event_seen();
++rgbled;
rgbled_red.output(0); rgbled_green.output(0); rgbled_blue.output(0);
if (rgbled == 1) rgbled_red.output(1);
if (rgbled == 2) rgbled_green.output(1);
if (rgbled == 3) rgbled_blue.output(1);
if (rgbled == 4) {rgbled = 0; rgbled_red.output(0); rgbled_green.output(0); rgbled_blue.output(0);}
break;
}