Robot-Will / Stino

A Sublime Text Plugin for Arduino
Other
1.58k stars 249 forks source link

Neopixel Strandtest Example with Due works with Arduino IDE, but not with Stino #219

Closed cosmikwolf closed 8 years ago

cosmikwolf commented 9 years ago

The Neopixel Strandtest.ino example sketch works just fine when compiled with Arduino IDE, but it does not work when compiled with Stino. I have tried changing all options I can think of in Sublime Text, but it refuses to work. The sketch will compile, and upload, but the LED pattern that is displayed does not animate as expected.

gonzoid commented 9 years ago

It seems the hardware interface is really time-specific. But I don't have any WS2811/WS2812 LED available to test myself, and there don't seem to have a lot of testing history for this library with Stino, apart maybe from #142.

Neopixel library has some assembly sections embedded in its code, unusual enough to be noted. Maybe this is why Stino doesn't support it yet?

Could you tell us which board you are using and describe more precisely how the LED pattern behave (random crap, swapped colors, etc.)?

cosmikwolf commented 9 years ago

I am using an Arduino Due with a 16 Neopixel Ring with WS2812 chips.

The code compiles and uploads, but the neopixels display random colors. The colors stay largely the same, however sometimes they will flicker after being on for a while, and sometimes the pattern will be one random pattern at startup, and then less than 1 second later change to another pattern, but stay static after that.

Also, the pattern seems to change when I change the code, but will stay the same when the same code is uploaded more than once.

Let me know if there is any testing I can do for you to help you troubleshoot. I can also take pictures of the result if that helps.

techydude commented 9 years ago

interesting that it compiles OK but doesn't drive them correctly. WS2812 'neopixels' are very timing dependent. I'm wondering if a CPU speed setting isn't right? check in ST>Arduino> Board Options that you've selected the maximum CPU speed 84MHz (& also check what it is in Arduino IDE). also incorporate the Arduino standard 'blink no wait' example code into your sketch and have it blink the onboard LED at once per second, or better still once per 10-seconds, and then time it to ensure the MCUs clock prescaler is being set up the same under both Arduino IDE & Stino.

I'll be poking around with this library on a Uno with Stino soon, so interested in how this pans out.

cosmikwolf commented 9 years ago

I dont see any options available in the ST > Arduino > Board Options menu for the Arduino Due.

I did the blink no wait test for 1 second and also 10 seconds and it appears that the timing is correct.

I have been using the Arduino Uno with this library and Stino just fine for a while, and I just upgraded to a Due, which is when everything started acting wonky!

cosmikwolf commented 9 years ago

So when I turned on verbose logging for compilation, I notice some minor differences between Stino and the arduino app in the output. This is the first line of the output from Stino, split up for readability:

/Applications/Arduino.app/Contents/Java/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-g++
-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib
-fno-threadsafe-statics --param max-inline-insns-single=500
-fno-rtti -fno-exceptions -Dprintf=iprintf -mcpu=cortex-m3 
-DF_CPU=84000000L -DARDUINO=158 -DARDUINO_SAM_DUE
-DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 
-DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" 
-DUSB_PRODUCT="Arduino Due" 
-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/system/libsam 
-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/system/CMSIS/CMSIS/Include/ 
-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/system/CMSIS/Device/ATMEL/ 
-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/cores/arduino 
-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/variants/arduino_due_x 
-I/Users/tenkai/Documents/Arduino/libraries/Adafruit_NeoPixel /var/folders/m8/cnc3yvx10kvfldn86j24dmkm0000gn/T/build2506048785832034928.tmp/strandtest.cpp 
-o /var/folders/m8/cnc3yvx10kvfldn86j24dmkm0000gn/T/build2506048785832034928.tmp/strandtest.cpp.o 

And here is the output from Stino:

"/Applications/Arduino.app/Contents/Java/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-g++"
-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib
-fno-threadsafe-statics --param max-inline-insns-single=500 
-fno-rtti -fno-exceptions -Dprintf=iprintf  -mcpu=cortex-m3 
-DF_CPU=84000000L -DARDUINO=158 -DARDUINO_SAM_DUE 
-DARDUINO_ARCH_SAM  -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 
-DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" 
-DUSB_PRODUCT="Arduino Due" 
"-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/system/libsam" 
"-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/system/CMSIS/CMSIS/Include/" 
"-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/system/CMSIS/Device/ATMEL/" 
"-I/Users/tenkai/Documents/Arduino/libraries/Adafruit_NeoPixel/examples/strandtest" 
"-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/cores/arduino" 
"-I/Applications/Arduino.app/Contents/Java/hardware/arduino/sam/variants/arduino_due_x" 
"-I/Users/tenkai/Documents/Arduino/libraries/Adafruit_NeoPixel" "/tmp/Stino_build/strandtest/strandtest.ino.cpp" 
-o "/tmp/Stino_build/strandtest/strandtest.ino.cpp.o"

I noticed that there is an additional "I/Users/tenkai/Documents/Arduino/libraries/Adafruit_NeoPixel/examples/strandtest" in the Stino output. Is it possible that this could be doing something strange?

cosmikwolf commented 9 years ago

I have also found that the Adafruit RGB LCD Library is not compatible with Stino.

Sketches using this library compile and upload just fine, but will not display any data.

The same sketch, when compiled and uploaded using the arduino app will work and display data.

Here is a link to the library: https://github.com/adafruit/Adafruit-RGB-LCD-Shield-Library

gonzoid commented 9 years ago

@cosmikwolf Arduino and Stino outputs are pretty similar and I don't think including the libraries/Adafruit_NeoPixel/examples/strandtest path could be responsible for your problem (it only contains the example sketch you are building). At this level, the WS2812 being a nitpicker, an appropriate way of debugging would be a logic analyzer. If you don't have one, there are cheap clones that can be found on eBay and such, they could come in handy in your toolbox since they are compatible with Saleae and USBee softwares. Did you see any difference in upload verbose output between Stino and Arduino?

@techydude Usually I use Arduino 1.0.6 which doesn't support Due board, but I just installed 1.5.8 for testing purpose and I don't see anything in the Arduino > Board Options menu, neither with Arduino Due (Programming Port) nor with Arduino Due (Native USB Port) selected.

zallesov commented 9 years ago

Adding myself to the thread as I experience exact same issue with ws2812 Led strip. It compiles in Stino, uploads but leds show random patterns, while uploading same sketch from Arduino IDE 1.6.1 gives expected result. It only applies to the DUE bard, with UNO all worked fine, but I rapidly ran out of memory with 484 Leds.

I dont want to switch from Stino to that horrible Arduino IDE. Please help!!!