Giter Club home page Giter Club logo

t1-firmware's Introduction

[UNMAINTAINED] This library does not have a maintainer. The source code and repository will be kept at this URL indefinitely. If you'd like to help maintain this codebase, create an issue on this repo explaining why you'd like to become a maintainer and tag @tessel/maintainers in the body.

Tessel Firmware

API documentation

Directory structure

  • src/ -- The main firmware source, including the C bindings to the hardware
  • builtin/ -- JS binding to hardware specific API calls (such as I2C, SPI, UART, GPIO)
  • lpc18xx/ -- NXP drivers for the LPC1830 peripherals
  • boot/ -- USB DFU bootloader
  • otp/ -- Factory setup to set the board version and install the bootloader. Can be used to update or reinstall the bootloader
  • erase/ -- Tool to erase the JS bundle from the bootloader if a bug makes the main firmware unusable
  • cc3k_patch/ -- Tool to update the CC3000 WiFi firmware

Compiling

Dependencies

Building the firmware requires gcc-arm-embedded, gyp, and ninja.

OS X

To install quickly on a Mac with Brew:

brew tap tessel/tools
brew install gcc-arm gyp ninja

Ubuntu 14.04, 14.10

Use the gcc-arm-embedded PPA:

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded && sudo apt-get update
sudo apt-get install git nodejs npm nodejs-legacy gcc-arm-none-eabi gyp ninja-build

Cloning the firmware repository

We'll clone the firmware repo itself into a folder called tessel/firmware. Inside your tessel folder, run:

git clone https://github.com/tessel/firmware
cd firmware
make update

Updating

To update your firmware version, you can git pull. Each time you pull a new commit of firmware, update your submodules and npm packages by running make update.

Compiling

Inside the tessel/firmware/ directory, run

make arm

This will build a binary. If you have no errors, you should have a new binary file called out/Release/tessel-firmware.bin.

Loading firmware onto Tessel

After building your firmware in the previous step, run tessel update ./out/Release/tessel-firmware.bin.

If broken firmware prevents tessel update from entering the bootloader automatically, hold the Config button while pressing and releasing the Reset button. The red and orange LEDs blink when in the bootloader mode.

Quick tip: You can build and deploy firmware in one step by running make arm-deploy.

Bootloader

The Tessel bootloader resides in the first 64k of the SPI flash chip and presents a standard USB DFU interface. It can load and execute code in either the firmware partition in flash, or in the LPC1830's internal SRAM.

To enter the bootloader, hold the Config button while resetting or powering on the board.

To run your C program in RAM, link it for address 0x10000000 beginning with an ARM vector table (example linker script), and tessel boot your_image.bin using the cli.

t1-firmware's People

Contributors

frijol avatar jiahuang avatar johnnyman727 avatar kevinmehall avatar lhuszko avatar linusu avatar mattsoftware avatar natevw avatar nlintz avatar nplus11 avatar olegas avatar peterhgombos avatar srl295 avatar tcr avatar tm-rampart avatar tmtestuser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

t1-firmware's Issues

Wifi process hanging (sometimes)

From the forums

Seems to be an issue with the process hanging on acquiring the IP address

Just got my tessel today (6/12/2014). Went through a couple of tutorials, and tried wifi.

First time around, the blinking orange light turned solid, and the console did the Acquiring IP address. with the dots. That eventually timed out, and it started "Retrying..."

and there it sits. This time it is not printing the little progress dots.

The orange light is solid, but it never gets out of the Acquiring IP address. on the command line.

I checked the router, and everything is fine there. I moved to within 15 feet of the router now, just to make sure.

I'm running from Windows 8.1

After a hard reboot of the tessel (removing usb cable, waiting a bit) the board comes up with a solid orange light.

tessel run wifi.js

Seems to run, returning 200 OK on the command prompt.

So, I guess it's just a hangup with acruiring the IP address. It must have acquired it, and then either the command itself hangs, or something else?

v0.1.8 broke http.createServer

After updating to version 0.1.8 my http servers no longer sends data to the clients.

Sample code is:

var http = require( 'http' );
console.log("Creating server");
http.createServer( function (req, res) {
console.log("Got a request!");
res.writeHead( 200, {'Content-Type': 'text/plain'} );
res.end('Hello World!\n');
console.log("Finished writing request");
}).listen( 8080 );

Tessel logs:

INFO Deploying bundle (5.00 KB)...
INFO Running script...
Creating server
Got a request!
Finished writing request

Client output:

curl http://192.168.0.10:80
curl: (52) Empty reply from server

Interrupt Handler Time Argument

GPIOs allow you to set interrupts on them and a time argument is returned in the callback.

Our documentation specifies that the time argument is in milliseconds but it's actually implemented as microseconds.

Which should we change? Microseconds seems useful from an embedded perspective but milliseconds is more in-line with how JS traditionally handles time (mostly thinking about setInterval and setTimeout).

CC3K doesn't properly error when binding to same port twice?

var net = require('net'),
    firstServer = net.createServer(),
    conflicting = net.createServer();
firstServer.listen(0, function () {
  var firstPort = firstServer.address().port;
  console.log(firstPort, "assigned a port");
  conflicting.listen(firstPort, function () {
    console.log("this should not be called!");
  });
  conflicting.on('error', function (e) {
    console.log(e, "got error as expected");
  });
});

After a fresh power cycle, this outputs:

1024 assigned a port
this should not be called!

See also tessel/t1-runtime#331 (comment)

Error compiling with `make arm` if repo absolute path contains space

postel:firmware natevw$ make arm
AR=arm-none-eabi-ar AR_host=arm-none-eabi-ar AR_target=arm-none-eabi-ar CC=arm-none-eabi-gcc gyp  firmware.gyp --depth=. -f ninja-arm -D builtin_section=.text -D COLONY_STATE_CACHE=0 -D COLONY_PRELOAD_ON_INIT=0 -D enable_ssl=1 && ninja -C out/Release
ninja: Entering directory `out/Release'
[113/322] CC obj/lpc18xx/Drivers/source/cmsis-lpc18xx.Font5x7.o
FAILED: arm-none-eabi-gcc -MMD -MF obj/lpc18xx/Drivers/source/cmsis-lpc18xx.Font5x7.o.d -DCOLONY_EMBED -DCONFIG_PLATFORM_EMBED -DTM_FS_vfs -D__thumb2__=1 -DGPIO_PIN_INT -D_POSIX_SOURCE -DREGEX_WCHAR=1 -DCOLONY_STATE_CACHE=0 -DCOLONY_PRELOAD_ON_INIT=0 '-D__TESSEL_FIRMWARE_VERSION__="a446554"' '-D__TESSEL_RUNTIME_VERSION__="cfae75f"' -I../../lpc18xx/Drivers/include -I../../lpc18xx/Core/CMSIS/Include -I../../lpc18xx/Core/Include -I../../lpc18xx/Core/Device/NXP/LPC18xx/Include -I../../lpc18xx/otp -I../../src/sys -mcpu=cortex-m3 -mthumb -gdwarf-2 -mtune=cortex-m3 -march=armv7-m -mlong-calls -mfix-cortex-m3-ldrd -mapcs-frame -msoft-float -mno-sched-prolog -ffunction-sections -fdata-sections -include /Users/natevw/Desktop/Clients/Technical Machine/firmware/deps/runtime/deps/axtls/config/embed/config.h -Wall -Werror -Ofast -std=gnu99  -c ../../lpc18xx/Drivers/source/Font5x7.c -o obj/lpc18xx/Drivers/source/cmsis-lpc18xx.Font5x7.o
arm-none-eabi-gcc: error: Machine/firmware/deps/runtime/deps/axtls/config/embed/config.h: No such file or directory
[113/322] ACTION cacert_bundle: cacert_bundle_compile_46b880c087b2aae3b9a9d8ead27b9b03
ninja: build stopped: subcommand failed.
make: *** [firmware] Error 1

Wifi error emission is messed up

➜  Twitter-Sumobot git:(master) ✗ tessel run index.js
TESSEL! Connected to TM-00-04-f000da30-005c4f48-422c2586.
INFO Bundling directory /Users/frijol/Twitter-Sumobot
INFO Deploying bundle (442.50 KB)...
INFO Running script...
Connecting...
TypeError: Uncaught, unspecified "error" event.
    at js_new (src/colony/lua/colony-init.lua:494)
    at emit (src/colony/lua/colony-node.lua:703)
    at _f (builtin/wifi-cc3000.js:136)
    at <anonymous> (builtin/wifi-cc3000.js:40)
    at connect (builtin/wifi-cc3000.js:40)
    at checkConnection (/app/index.js:23)
    at res (/app/index.js:10)
    at run (src/colony/lua/colony-node.lua:1082)
    at require (src/colony/lua/colony-node.lua:1077)
    at res (/_start.js:4)

Code:

// Get Tessel connected to Wifi
var tessel = require('tessel');
var wifi = require('wifi-cc3000');
var wifiSettings = {
  ssid: 'Gaumenkitzel',
  password: 'Gaumenkitzel',
  timeout: 40
};

checkConnection();

wifi.on('disconnect', function () {
  console.log('Disconnected.');
  checkConnection();
});

function checkConnection () {
  if (wifi.isConnected()) {
    console.log('Connected.');
    main();
  } else {
    console.log('Connecting...');
    wifi.connect(wifiSettings, function (err, res) {
      if(err) {
        console.log('Error connecting:', err);
      }
      checkConnection();
    });
  }
}

function main () {
  // Set up Twitter
  console.log('Setting up Twitter...');
  var twitter = require('twitter');
  var util = require('util');
  var twit = new twitter({
    consumer_key: 'O7oc0pvsZn4xjgcuHuYdX4FaC',
    consumer_secret: 'iJYuHFz2sD46Nvk3mcwzX8uih14aEAMgVWdWoR59nx8v6Zl7ZX',
    access_token_key: '2529232909-luARGU89K4CKFMvfzBjCgG6ubefzDkdDWkSB85i',
    access_token_secret: 'GXQfuzvGdjLEs3t1HEYfhQ9x9bdBcSBVXjBkbRgwYlOE0'
  });
  tessel.led[0].output(1);
  console.log('Twitter is all set up.');

  // Set up servos
  var servoLib = require('servo-pca9685');
  var servo = servoLib.use(tessel.port['A']);

  // When servo module is ready...
  servo.on('ready', function () {
    console.log('Servo module ready. Listening for tweets...');
    tessel.led[1].output(1);
    // Stream tweets that mention the keyword
    twit.stream('statuses/filter', {track:'#Tesselbot'}, function(stream) {
      stream.on('data', function(data) {
        var tweet = data.text;
        console.log(tweet);
        if (tweet.indexOf('forward') > 0) {
          forward();
        } else if ( tweet.indexOf('back') > 0 ) {
          back();
        } else if (tweet.indexOf('right') > 0 ) {
          right();
        } else if (tweet.indexOf('left') > 0) {
          left();
        } else {
          // Anything not an explicit command makes it stop
          stop();
        }
      });
      stream.on('error', function (err) {
        console.log('Twitter error:', err);
      });
    });
  });
}

// Motion functions
function forward() {
  console.log('Moving: forward');
  servo.move(1, 1);
  servo.move(2, 0);
}

function back() {
  console.log('Moving: back');
  servo.move(1, 0);
  servo.move(2, 1);
}

function right() {
  console.log('Moving: right');
  servo.move(1, 1);
  servo.move(2, 1);
}

function left() {
  console.log('Moving: left');
  servo.move(1, 0);
  servo.move(2, 0);
}

function stop() {
  console.log('Stopping.');
  servo.move(1, 0.5);
  servo.move(2, 0.5);
}

SPI bitOrder value

When specifying a bitValue of 'msb' (which is the default) the tessel throws an error at me.

this.spi = new port.SPI({
  clockSpeed: 4*1E6,
  cpol: 0,
  cpha: 0,
  bitOrder: 'msb',
  chipSelect: this.CS,
  chipSelectActive: 'low'
});
Error: Invalid property value
    at _new ([string "colony-init.lua"]:1)
    at propertySetWithDefault ([string "tessel.js"]:49)
    at f ([string "tessel.js"]:1183)
    at _new ([string "colony-init.lua"]:1)
    at f ([string "tessel.js"]:1425)
    at _new ([string "colony-init.lua"]:1)
    at f (/app//index.js:34)
    at _new ([string "colony-init.lua"]:1)
    at use (/app//index.js:78)
    at res (/app/test.js:5)

Removing just bitOrder: 'msb', fixes it...

tessel update throws an error

a@UBUNTU02:~$ tessel update

/home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/node_modules/bindings-shyp/bindings.js:107
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/build/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/build/Debug/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/build/Release/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/out/Debug/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/Debug/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/out/Release/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/Release/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/build/default/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/compiled/0.10.33/linux/x64/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/node_modules/usb-shyp-linux-x64/node-v11/usb_bindings.node
→ /home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/node_modules/usb-shyp-linux-x64/usb_bindings.node
at bindings (/home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/node_modules/bindings-shyp/bindings.js:104:9)
at Object. (/home/a/.nvm/v0.10.33/lib/node_modules/tessel/node_modules/usb/usb.js:1:124)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/a/.nvm/v0.10.33/lib/node_modules/tessel/src/tessel_usb.js:10:44)
at Module._compile (module.js:456:26)

If `tessel run` script uses network, `tessel push`ed script runs instead

This one is a little weird, I haven't gotten to the bottom of it. If a script uses the net/tls modules, and you try to tessel run it before the WiFi connects, the Tessel just silently executes whatever was the last tessel push script instead.

So for whatever reason you can't even write a script that includes wifi.on('connect', function () { … }) since it never even gets that far.

.output not recognized by analog pins

this works

var tessel = require('tessel'); // import tessel
var gpio = tessel.port['GPIO']; // select the GPIO port
var myPin = gpio.analog[0]; // can be gpio.digital[0-5] or gpio.pin['G3'] through G6
// Turn on the pin
myPin.write(1); // setting ‘true’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());
// Turn off the pin
myPin.write(0); // setting ‘false’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());

but this doesn't

var tessel = require('tessel'); // import tessel
var gpio = tessel.port['GPIO']; // select the GPIO port
var myPin = gpio.analog[0]; // can be gpio.digital[0-5] or gpio.pin['G3'] through G6
// Turn on the pin
myPin.output(1); // setting ‘true’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());
// Turn off the pin
myPin.write(0); // setting ‘false’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());

cited error:
/app/scratch.js:5: attempt to call method 'output' (a nil value)

Arduino Support

Are there docs on how to get arduino connected?

For those of you who already have stacks and stacks of Arduino shields, don’t despair—you can still
use them! If we’re funded, we’ll make interfacing with Arduino a first-class experience. With just one 
cable, send and receive data directly from your Arduino stack using your existing C libraries. Or, use 
our firmware to control the Arduino board directly using JavaScript!

Add SmartConfig functionality

TI's SmartConfig allows you to use a mobile app to set the WiFI credentials of the CC3000 WiFi chip. We put the config button on the board specifically to tie in to this service but haven't exposed it yet. This could be useful for folks who have finished up a project, embedded it in something, and want to move it around.

`gcc-4.9: No such file or directory` building arm LuaJIT on OS X

postel:firmware natevw$ brew tap tessel/tools
Warning: Already tapped!

postel:firmware natevw$ brew install gcc-arm gyp ninja
Warning: gcc-arm-arm already installed
Warning: gyp-1.0 already installed
Warning: ninja-1.5.1 already installed

postel:firmware natevw$ make arm
make -C deps/runtime prepare-arm
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src clean
rm -f luajit libluajit.a libluajit.so host/minilua host/buildvm lj_vm.s lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h host/buildvm_arch.h jit/vmdef.lua *.o host/*.o *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
AR=arm-none-eabi-ar AR_host=arm-none-eabi-ar AR_target=arm-none-eabi-ar CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ gyp  firmware.gyp --depth=. -f ninja-arm -D builtin_section=.text -D COLONY_STATE_CACHE=0 -D COLONY_PRELOAD_ON_INIT=0 -D enable_luajit=1 -D enable_ssl=1 -D enable_net=1 && ninja -C out/Release
ninja: Entering directory `out/Release'
[3/213] ACTION colony-luajit: luajit-build_8bb79713ca05416016f6c82e41a26dc4
FAILED: cd ../../deps/runtime; tools/luajit-build.sh arm ../../out/Release/obj/deps/runtime/colony-luajit.gen/libluajit.o
==== Building LuaJIT 2.0.3 ====
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src
HOSTCC    host/minilua.o
make[2]: gcc-4.9: No such file or directory
make[2]: *** [host/minilua.o] Error 1
make[1]: *** [default] Error 2
cp: deps/colony-luajit/src/libluajit.a: No such file or directory
[3/213] CXX obj/deps/runtime/src/libtm-cxx.std.o
ninja: build stopped: subcommand failed.
make: *** [firmware] Error 1

[MOVED] Connection Errors does not seem to be handled correctly (using poor wifi)

It happend really often for me (during nodeconf) that my tessel script chrashed and I got a

Error: ENOENT Cannot connect to 10.11.83.177
stack traceback:
    [T]:src/colony/modules/net.js:109: in function <[T]:src/colony/modules/net.js:121>

I used http to send a get request like this:

http
          .get('http://10.11.83.177:8082/ws/remote?text= New Weather Report has arrived it is' + weather, function (res) {
            console.log("new weatherReport sent");
          })
          .on('error', function(e) {
            console.log("Got error: " + e.message);
          });

I guess it should hit the error handler and not just crash. Or did I do something wrong?

Ability to switch between digital and analog capabilities for A2 and A4

Our [documentation] mentions being able to switch the GPIO bank pin A2 and A4 between digital and analog signals. That is currently not implemented in the firmware.

First step here would be writing a quick Request For Comment (RFC) and posting it on the forums to discuss how to expose that API (pin.type('analog') or whatever).

Then, add that API to tessel.js. You'll want to use the underlying binding to the set_mode function.

delayed UART initialization causes problems with BLE

In the UART initialization logic, all of the state variables are set, and then the actual initialization is put inside a setImmediate call. Because BLE opens a UART port, then toggles the reset line, it expects to receive bootup data immediately. Unfortunately, it misses the data because the port isn't initialized until after the data is sent from the BLE module to Tessel.

The initialization is currently within setImmediate so that you can create a UART port, then add listeners before the uart object emits any data. I believe the idea was that you would get that data once the event loop got to the setImmediate but that's not how it works.

I propose removing the setImmediate call and just initializing and registering the data listener right away.

Error building with `make arm`

I suspect this is trouble on my end, but filing in case anyone else hits this:

postel:firmware natevw$ make arm
AR=arm-none-eabi-ar AR_host=arm-none-eabi-ar AR_target=arm-none-eabi-ar CC=arm-none-eabi-gcc gyp  firmware.gyp --depth=. -f ninja-arm -D builtin_section=.text -D COLONY_STATE_CACHE=0 -D COLONY_PRELOAD_ON_INIT=0 -D enable_ssl=1 && ninja -C out/Release
ninja: Entering directory `out/Release'
[4/324] CC runtime/deps/c-ares/c-ares.ares__close_sockets.o
FAILED: arm-none-eabi-gcc -MMD -MF runtime/deps/c-ares/c-ares.ares__close_sockets.o.d -DCOLONY_EMBED -DCONFIG_PLATFORM_EMBED -DTM_FS_vfs -DHAVE_CLOSESOCKET -DENABLE_TLS -DHAVE_CONFIG_H -I../../../runtime/deps/axtls/config -I../../../runtime/deps/c-ares -mcpu=cortex-m3 -mthumb -mtune=cortex-m3 -march=armv7-m -mlong-calls -mfix-cortex-m3-ldrd -mapcs-frame -msoft-float -mno-sched-prolog -ffunction-sections -fdata-sections -std=c99 -Wall -Werror -Wno-error=unused-parameter -ggdb -Wno-unused-result -Wno-unused-value -Wno-unused-function -Wno-unused-variable -std=gnu99 -O3   -c ../../../runtime/deps/c-ares/ares__close_sockets.c -o runtime/deps/c-ares/c-ares.ares__close_sockets.o
dyld: Library not loaded: /usr/local/lib/libmpc.3.dylib
  Referenced from: /Users/natevw/Development/Pebble/arm-cs-tools/bin/../libexec/gcc/arm-none-eabi/4.6.3/cc1
  Reason: image not found
arm-none-eabi-gcc: internal compiler error: Trace/BPT trap: 5 (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/jsnyder/arm-eabi-toolchain> for instructions.
[4/324] CC runtime/deps/c-ares/c-ares.ares__get_hostent.o
FAILED: arm-none-eabi-gcc -MMD -MF runtime/deps/c-ares/c-ares.ares__get_hostent.o.d -DCOLONY_EMBED -DCONFIG_PLATFORM_EMBED -DTM_FS_vfs -DHAVE_CLOSESOCKET -DENABLE_TLS -DHAVE_CONFIG_H -I../../../runtime/deps/axtls/config -I../../../runtime/deps/c-ares -mcpu=cortex-m3 -mthumb -mtune=cortex-m3 -march=armv7-m -mlong-calls -mfix-cortex-m3-ldrd -mapcs-frame -msoft-float -mno-sched-prolog -ffunction-sections -fdata-sections -std=c99 -Wall -Werror -Wno-error=unused-parameter -ggdb -Wno-unused-result -Wno-unused-value -Wno-unused-function -Wno-unused-variable -std=gnu99 -O3   -c ../../../runtime/deps/c-ares/ares__get_hostent.c -o runtime/deps/c-ares/c-ares.ares__get_hostent.o
dyld: Library not loaded: /usr/local/lib/libmpc.3.dylib
  Referenced from: /Users/natevw/Development/Pebble/arm-cs-tools/bin/../libexec/gcc/arm-none-eabi/4.6.3/cc1
  Reason: image not found
arm-none-eabi-gcc: internal compiler error: Trace/BPT trap: 5 (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/jsnyder/arm-eabi-toolchain> for instructions.
ninja: build stopped: subcommand failed.
make: *** [firmware] Error 1
postel:firmware natevw$ 

A few dozen small, but rapid, socket exchanges kills CC3K

Run this somewhere the Tessel can talk to:

require('net').createServer(function (sock) {
  sock.on('data', sock.write);
}).listen(5004, function () {
  console.log("listening", this.address().port);
});

Run this with tessel run -l all -s script.js:

require('net').connect(5004, "192.168.4.114", function () {
  console.log("connected, initiating writes");
  for (var i = 0; i < 25; i += 1) this.write(".");
  this.end();
});

Gets stuck in a loop like the following, and then needs a power cycle before doing any other WiFi stuff:


Sending 1 bytes <Buffer 2e>
tSLInformation.usNumberOfFreeBuffers 1
HCI Event error on command: 1008
HCI Event error on command: 1008
HCI Event error on command: 1008
HCI Event error on command: 1008
kicking out of buffer wait
HostFlowControlConsumeBuff is bad -5
Sending 1 bytes <Buffer 2e>
tSLInformation.usNumberOfFreeBuffers 1
HCI Event error on command: 1008

Full log at https://gist.github.com/natevw/6c39419e1e3bca9bf17c

Enforce socket limit on CC3k...? maybe?

Given this test script:

var http = require('http');

setInterval(function() {
  var req = http.request(
    { hostname: 'httpstat.us',
      path: '/200',
      method: 'GET'}
    , function(res) {
      res.on('data', function(chunk) { console.log("BODY: " + chunk) })
    });

  req.on('error', function(e) { console.log("Problem with request: %s", e.message)});

  req.end();
},
500);

Only 4 sockets can be open simultaneously on the CC3000 at once. By the end of the log, 5 are in use, the last traces I get from the CC are:

 ← read  HCI_EVNT_SOCKET               <- socket #5 opened.
 → write HCI_CMND_SETSOCKOPT           24 bytes: <Buffer 05 00 00 00 ff ff 00 00 00 40 00 00 08 00 00 00 04 ...>
 ← read  HCI_EVNT_SETSOCKOPT           4 bytes: <Buffer ff ff ff ff>
 → write HCI_CMND_CONNECT              -> connecting socket #5... (8.8.8.8)
 ← read  HCI_EVNT_CONNECT              4 bytes: <Buffer 00 00 00 00>
 → write          DATA                 46 'bytes:' <Buffer 05 00 00 00 0c 00 00 00 1d 00 00 00 00 00 00 00 b6 ...>
 ← read  HCI_EVNT_SEND                 8 bytes: <Buffer 05 00 00 00 1d 00 00 00>
 → write HCI_CMND_SELECT               → r .... w .... e .... [non-blocking, timeout: 3125ms]

That timeout is incredibly long, especially since our sockopts are all 5ms. Maybe a bad SPI trace, maybe an error signal?

The full logs are here. There should have been 10+ requests that have gone through the CC3k, however only 5 made it up through the event loop.

WARN Warning. Deploying just this file.
INFO Bundling directory /Users/jialiya/projects/technical/test/wifi
INFO Deploying bundle (5.00 KB)...
INFO Running script...
BODY: 200 OK
BODY: 200 OK
BODY: 200 OK
BODY: 200 OK
BODY: 200 OK

Backtracing gets me to CC_BLOCKS. My guess is that we miss an IRQ somewhere and then get thrown into an inconsistent state.

(gdb) bt
#0  CC_BLOCKS () at ../../src/cc3000/host_spi.c:37
#1  0x1401b152 in hci_event_handler (from=0x0, fromlen=0x0,
    pRetParams=<optimized out>) at ../../src/cc3000/utility/evnt_handler.c:250
#2  SimpleLinkWaitEvent (usOpcode=<optimized out>, pRetParams=<optimized out>)
    at ../../src/cc3000/utility/evnt_handler.c:834
#3  0x1401be10 in select (nfds=<optimized out>, readsds=0x10089c90,
    writesds=0x10089c94, exceptsds=0x10089c98, timeout=0x10089c9c)
    at ../../src/cc3000/utility/socket.c:645
#4  0x140218ac in wait_ares (channel=0x281368f0)
    at ../../deps/runtime/src/colony/lua_cares.c:83
#5  tm__sync_gethostbyname (domain=<optimized out>)

Currently my guess is that if we enforce the 4 socket limit this shouldn't be resolved. Worth investigating further to see if:

  1. Are the other 5+ GET responses somewhere in the event queue and we're going to handle them, but get caught up in CC_BLOCKS before we can?
  2. Do the first responses I get back correspond to the first sockets getting data on the CC3k?
  3. Is there a way to recover once we get into an inconsistent CC state?

Doing the same thing with POST requests gives me this log. The 5th socket request never completes.

Need workaround for `tessel.port['GPIO'].pwm[0]` for TM02

I'm having trouble outputting PWM on my TM-00-002 board:

var port = require('tessel').port.GPIO,
    pin = port.pwm[0];
port.pwmFrequency(50);
console.log(pin);
pin.pwmDutyCycle(0.6);

Outputs:

{ pin: 37, isPWM: true, interrupts: {} }
Error: PWM is not suported on this pin

CC3K can't connect to LAN address?

Seems potentially related to #60. My Tessel is on LAN (TomatoUSB router) and has IP 192.168.1.5. Laptop has IP 192.168.1.6. I can ping from laptop (.6) to Tessel (.5) just fine.

But when I start nc -kl 8080 on laptop and run this script:

//require('http').get("http://192.168.1.6:8080", function(res) {
require('http').get("http://postel:8080", function(res) {
//require('http').get("http://ipcalf.com:8080", function(res) {
  console.log("Got response: " + res.statusCode);
  res.on('data', function (d) { console.log(d.toString()); });
}).on('error', function(e) {
  console.log("Got error: " + e.message);
});

I get the following error:

Got error: ENOENT Cannot connect to 192.168.1.6 Got: err-5

So Tessel has DNS resolved from "postel" to "192.168.1.6" via my router, but now can't connect. (I don't see any TCP handshake attempt in Wireshark.) I'm certain this is not just an interface binding issue, I can connect to the nc listener on my laptop just fine from any other machine on my network.

If, however, I set up a remote tunnel to my laptop via a remote server (third commented line), Tessel can connect via that to my laptop just fine O_o

Parameters of `uart.setParity` and `uart.setDataBits` not validated properly

Originally reported on the forums.

var tessel = require('tessel');
var port = tessel.port['A'];
var blueToothSerial = new port.UART();

// Throws Error
blueToothSerial.setDataBits(8);

// Throws Error
blueToothSerial.setParity("none");

Error that is thrown:

> blueToothSerial.setParity("none");
Error: Invalid parity value
    at redo (/usr/local/lib/node_modules/tessel/node_modules/structured-clone/serialize.js:136:16)
    at rez (/usr/local/lib/node_modules/tessel/node_modules/structured-clone/serialize.js:168:25)
    at redo (/usr/local/lib/node_modules/tessel/node_modules/structured-clone/serialize.js:147:17)
    at rerez (/usr/local/lib/node_modules/tessel/node_modules/structured-clone/serialize.js:174:7)
    at Function.exports.deserialize (/usr/local/lib/node_modules/tessel/node_modules/structured-clone/serialize.js:222:10)
    at Tessel.<anonymous> (/usr/local/lib/node_modules/tessel/src/commands.js:112:32)
    at Tessel.emit (events.js:95:17)
    at InEndpoint.<anonymous> (/usr/local/lib/node_modules/tessel/src/tessel_usb.js:217:14)
    at InEndpoint.emit (events.js:95:17)
    at Transfer.transferDone (/usr/local/lib/node_modules/tessel/node_modules/usb/usb.js:273:9)

The parameters are not validated properly in tessel.js.

Inconsistent chaining

Hi,

I was very pleased to note that the Tessel built-in classes, like Pin, support chaining:

var pin = gpio.digital[0].input();

However, this seems to have been applied quite randomly to the codebase. Most functions do return this but others, such as .toggle() and .pulse(), do not. Some, like .write(), explicitly do not return the instance.

Is this intentional or just an oversight?

Adding pin name as pin property

Originally posted in private Beta repo.

I propose we add each pin's name as one of its properties. The reason being that it's currently useless to call something like pin.analog as it returns:

[ { pinmode: 'input', pin: 28 }, { pinmode: 'input', pin: 29 }, { pinmode: 'input', pin: 30 }, { pinmode: 'input', pin: 31 }, { pinmode: 'input', pin: 32 }, { pinmode: 'input', pin: 33 } ]
That doesn't tell me which pins I can use for analog reads.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.