Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 30

Thread: Teensyduino 1.49 Beta #4

  1. #1
    Administrator Paul's Avatar
    Join Date
    Oct 2012
    Posts
    374

    Teensyduino 1.49 Beta #4

    Teensyduino 1.49 Beta #4

    Here is a fourth beta test for Teensyduino 1.49.



    EDIT: links removed, please use 1.49-beta5



    Changes since Teensyduino 1.49-beta3

    Audio fix simultaneous input & output on I2S2
    Audio allow larger queue & delay effect on Teensy 4.0
    FastLED updated to allow WS2812Serial driver on Teensy 4.0 (KurtE)
    PulsePosition support for Teensy 4.0 (mjs513)
    TimerOne & TimerThree updates & fixes for Teensy 4.0 timers
    Update ADC library (pedvide)
    Update RA8875 for Teensy 4.0 (mjs513)
    Add QuadTimer library (mjs513)
    Add FlexCAN_T4 (tonton81)
    Add ILI9488_t3 (mjs513)
    Port ssd1351 to Teensy 4.0 (KurtE)
    Port SoftPWM to Teensy 4.0
    Add ADC_ETC definitions to imxrt.h (KurtE)
    Adjust Wire library pin drive strenth on Teensy 4.0
    Optimize Ethernet CS on Teensy 4.0 (Remo Jongeneelen)
    Include stdbool.h - needed by Temboo library
    Fix micros() non-monotonic output on Teensy 4.0 with slow CPU speeds
    Optimize micros() on Teensy 4.0
    ST7735_t3 & WS2812Serial minor cleanup

  2. #2
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,371
    @Paul

    Loaded up Beta4 with no problem on my Win10x64 Home Edition PC.

    Did some quick tests with the BNO080 and getting the sketches to run properly without hanging is a little flaky. Let me explain since it seems to be sketch dependent:
    Example15-RawReadings: ran on first upload
    Example4-Magnetometer: hung on first load but ran when after I hit the program button again
    Example1-RotationVector: hung when I first did it and wouldn't start up no matter what, but since I as I am writing this and retesting the sketches in this order it ran after I loaded the previous 2 examples.
    Example10-PrintPacket: hung on first load, hit pgm again and still hung. I then removed the USB Cable, let sit a minute powered off, and replugged usb back into PC still hung, but then I hit the reset button and it started working
    Example13-Timestamp: hung on load and had to power off and on, then it ran

    Ok that's about it for now. Have Dr's appointment so will play more later

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    @Paul @mjs513 - Installed Win10 64 bit, Arduino 1.8.10...


    BNO080 testing. Using Sparkfun sensor connected to my FRDM T4 castellated test board, with sensor connected using QWIIC connector:
    Click image for larger version. 

Name:	IMG_1014.jpg 
Views:	37 
Size:	131.9 KB 
ID:	18556

    Pardon the messy desk.

    BNO080 - Example 15 Ran no problem.

    Then tried Example 1 and it uploaded and ran twice...
    Code:
    BNO080 Read Example
    
    Rotation vector enabled
    
    Output in form i, j, k, real, accuracy
    
    0.00,0.00,0.00,0.00,0.00,
    
    0.00,0.00,0.00,0.00,0.00,
    
    -0.13,0.15,-0.47,0.86,0.79,
    
    -0.13,0.15,-0.47,0.86,0.79,
    
    -0.13,0.15,-0.47,0.86,0.79,
    
    -0.13,0.15,-0.47,0.86,0.79,
    ...
    Example 2 hangs... All it outputs is:
    Code:
    BNO080 Read Example
    Now to debug some... First a few more debug messages to see where it is not returning from...

    UPDATE:

    Note: It hangs in the IMU.begin.
    Code:
    void setup()
    {
      while (!Serial && millis() < 5000) ;
      Serial.begin(9600);
      Serial.println();
      Serial.println("BNO080 Read Example");
    
      Wire.begin();
    
      myIMU.begin();
      Serial.println("BNO080 After myIMU.begin"); Serial.flush();
    
      Wire.setClock(400000); //Increase I2C data rate to 400kHz
    
      myIMU.enableAccelerometer(50); //Send data update every 50ms
    
      Serial.println(F("Accelerometer enabled"));
      Serial.println(F("Output in form x, y, z, in m/s^2"));
    }
    EDIT: However if I power it off and then back on, it runs this example

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    Update: Again it appears to be a startup/reset type issue, with Wire and/or BNO080...

    Example I ran a couple of tests again and then tried to reprogram again with Example 2 and it hung...

    Logic analyzer capture showed:
    Setup to write 96 ACK,
    Writes: 0x5 0x00 0x01 0x00 0x01 <All with ACKs returned>
    a 50ms delay
    Setup to read 97 Ack:
    0x13, 0x00, 0x03 0xdf - Ack's on first 3 nack on last.

    Then a Read 0x97 <NAK> and that was the final thing that happened...

    Which by sources gets us to BNO080::softReset
    Code:
    void BNO080::softReset(void)
    {
    	shtpData[0] = 1; //Reset
    
    	//Attempt to start communication with sensor
    	sendPacket(CHANNEL_EXECUTABLE, 1); //Transmit packet on channel 1, 1 byte
    
    	//Read all incoming data and flush it
    	delay(50);
    	while (receivePacket() == true)
    		;
    	delay(50);
    	while (receivePacket() == true)
    		;
    }
    First sendPacket is the reset command.
    Which is:
    Code:
    05 packet length low
    00 packet lenth high
    01 Channel 1
    00 Sequence number
    01 Reset command
    We are hanging in the receivePacket loop. Which (removed the SPI stuff for message)
    Code:
    boolean BNO080::receivePacket(void)
    {
    	{
    		_i2cPort->requestFrom((uint8_t)_deviceAddress, (uint8_t)4); //Ask for four bytes to find out how much data we need to read
    		if (waitForI2C() == false)
    			return (false); //Error
    
    		//Get the first four bytes, aka the packet header
    		uint8_t packetLSB = _i2cPort->read();
    		uint8_t packetMSB = _i2cPort->read();
    		uint8_t channelNumber = _i2cPort->read();
    		uint8_t sequenceNumber = _i2cPort->read(); //Not sure if we need to store this or not
    
    		//Store the header info.
    		shtpHeader[0] = packetLSB;
    		shtpHeader[1] = packetMSB;
    		shtpHeader[2] = channelNumber;
    		shtpHeader[3] = sequenceNumber;
    
    		//Calculate the number of data bytes in this packet
    		int16_t dataLength = ((uint16_t)packetMSB << 8 | packetLSB);
    		dataLength &= ~(1 << 15); //Clear the MSbit.
    		//This bit indicates if this package is a continuation of the last. Ignore it for now.
    		//TODO catch this as an error and exit
    		if (dataLength == 0)
    		{
    			//Packet is empty
    			return (false); //All done
    		}
    		dataLength -= 4; //Remove the header bytes from the data count
    
    		getData(dataLength);
    	}
    
    	return (true); //We're done!
    }
    So it is asking Wire for 4 bytes, and received: 0x13, 0x00, 0x03 0xdf

    Data length is: 0x0013 or 19 bytes. We then call getData...

    Code:
    boolean BNO080::getData(uint16_t bytesRemaining)
    {
    	uint16_t dataSpot = 0; //Start at the beginning of shtpData array
    
    	//Setup a series of chunked 32 byte reads
    	while (bytesRemaining > 0)
    	{
    		uint16_t numberOfBytesToRead = bytesRemaining;
    		if (numberOfBytesToRead > (I2C_BUFFER_LENGTH - 4))
    			numberOfBytesToRead = (I2C_BUFFER_LENGTH - 4);
    
    		_i2cPort->requestFrom((uint8_t)_deviceAddress, (uint8_t)(numberOfBytesToRead + 4));
    		if (waitForI2C() == false)
    			return (0); //Error
    
    		//The first four bytes are header bytes and are throw away
    		_i2cPort->read();
    		_i2cPort->read();
    		_i2cPort->read();
    		_i2cPort->read();
    
    		for (uint8_t x = 0; x < numberOfBytesToRead; x++)
    		{
    			uint8_t incoming = _i2cPort->read();
    			if (dataSpot < MAX_PACKET_SIZE)
    			{
    				shtpData[dataSpot++] = incoming; //Store data into the shtpData array
    			}
    			else
    			{
    				//Do nothing with the data
    			}
    		}
    
    		bytesRemaining -= numberOfBytesToRead;
    	}
    	return (true); //Done!
    }
    And we get a NAK and then do recover... Now to debug what happens in getData...

    Should we continue on this thread or back to another BNO specific one?

    EDIT: my guess is more work needed in: requestFrom function...

    Like probably needing to handle NAK, plus I saw it hang with SCL HIGH and SDA LOW and just sit there...
    Last edited by KurtE; 12-27-2019 at 04:17 PM.

  5. #5
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,371
    @KUrtE

    Just got back from the Eye Doctor - with all the drops in the eyes everything is blurry.

    But think maybe we should move the BNO080 issues to its own thread: https://forum.pjrc.com/threads/58268...ghlight=bno080. What about in that thread.

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,831
    Did 1.49b4 download install Win 10.pro all well - no system interference or install trouble.
    > micros() update looks good at right at 24 MHz and 600 MHz
    > running SSD1306 at default 100KHz and 4MHz works on T4

  7. #7
    Member
    Join Date
    Jan 2015
    Location
    France
    Posts
    81
    Hi,

    ADC seem to have a problem with T4. Pedvide updated his repository yesterday to fix the issue.

    thanks,
    Manu

  8. #8
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,371
    @Manu

    Yep. The old version of ADC was only designed on T3.x versions of the Teensy. The Update that Pedvide incorporated in to ADC library the other day allows it to run on not only the T3.x but also on the T4. The updated library will probably be incorporated into the next release of Teensyduino.

  9. #9
    Junior Member
    Join Date
    Sep 2019
    Posts
    14
    I know I'm a little late, but thanks for getting the USB stuff added to the Teensy 4.0. Works great, had to adjust my code because the T4 is so friggen fast!

  10. #10
    Junior Member
    Join Date
    Sep 2019
    Posts
    6
    Ok, Teensy 4.0 teensyduino 1.49 beta4 analogRead problem:

    I'm reading the wiper of a 100k pot with the ends connected to ground and +3.3V respectively with no analog filtering.

    Code:
    const int ANALOG_PIN = A1;
    
    void setup() {
      analogReadResolution(12);     
      Serial.begin(38400);
    }
    
    void loop() { 
      
      while (usbMIDI.read()) { }  // read & ignore incoming messages
      
      
      float value = (float)analogRead(ANALOG_PIN);
      
      usbMIDI.sendControlChange(32, value / 32, 1);
      Serial.print(value);
      Serial.print('\n');
      
      delay(5);  
    }
    There seems to be a discontinuity around the 50% mark, but its not the same going up and going down:
    Serial plot of the data

    Click image for larger version. 

Name:	teensy4.0 analog read.jpg 
Views:	25 
Size:	59.0 KB 
ID:	18648

    For reference the same sketch on Teensy 3.0 with the same wiring and same potentiometer:

    Click image for larger version. 

Name:	teensy3.0analogread.jpg 
Views:	17 
Size:	58.8 KB 
ID:	18649

    Just turning the pot up and down repeatedly with a little pause at either end trying to move it smoothly.

  11. #11
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    @Paul,
    I noticed that Cut and paste works slightly differently if I use Teensy Serial port
    Code:
    USB Host Testing
    
    960
    
    *** Device HID1 1241:1177 - connected ***
    *** HID Device Mouse1 1241:1177 - connected ***
    Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
    
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -1,  wheel = 0,  wheelH = 0
    
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -1,  wheel = 0,  wheelH = 0
    
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -1,  wheel = 0,  wheelH = 0
    
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -2,  wheel = 0,  wheelH = 0
    versus, choosing the serial port (not part of the Teensy section:
    Code:
    USB Host Testing
    960
    *** Device HID1 1241:1177 - connected ***
    *** HID Device Mouse1 1241:1177 - connected ***
    Mouse: buttons = 0,  mouseX = 0,  mouseY = 0,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 1,  mouseY = -1,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 1,  mouseY = -1,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 1,  mouseY = 0,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -1,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 1,  mouseY = 0,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -1,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 1,  mouseY = 0,  wheel = 0,  wheelH = 0
    Mouse: buttons = 0,  mouseX = 0,  mouseY = -1,  wheel = 0,  wheelH = 0
    Notice the Teensy Ports version puts in blank lines...

  12. #12
    Junior Member
    Join Date
    Jan 2020
    Posts
    14
    Hello,

    Il moved from Teensy LC to Teensy 4.0. Using I2C and fastled with Teensy Loader 1.49-beta 4.
    I am pretty sure that I have still a problem of interruption during FastLED.show();
    My code works, when I2C transmission does not occur during fast.ledshow, but I2C is fuzzy when transmissions occur during fastled.show

    The Teensy 4.0 is a slave, a rapsberry being the master


    Hope It is clear that that you can help fixing…

    Philippe



    #include <Arduino.h>
    #include <i2c_driver.h>
    #include "imx_rt1060/imx_rt1060_i2c_driver.h"

    #include "FastLED.h"

    ….
    init :
    ….
    LEDS.addLeds<NUM_STRIPS,WS2812,LED_RUBAN_PIN,GRB>( leds,MAX_LED_NB);


    function that makes the problem
    // Tache Mise à jour des leds
    #define TACHE_LED_AFICH 2
    int func_led_affich (int tache_num, byte data1, byte data2)
    {
    // la liaison I2C n'accroche pas avec show non synchronisé car show n'est pas compatible des interruptions
    //if ((status_teensy_i2c ==2)|| (RASPBERRY ==0))
    // {
    // ti = millis();
    FastLED.show();

    // Serial.print (" hsh:");Serial.println (millis () - (long) ti);
    // }

    return (0);
    }

  13. #13
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,118
    Quote Originally Posted by KurtE View Post
    Notice the Teensy Ports version puts in blank lines...
    I've seen that too, but so far mostly ignored it. It's now on my list of low priority bugs.

    There's also strangeness with horizontal scroll position after printing very long lines.

    Will probably wait until Arduino 1.8.11 to do any more work on the Java code.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,118
    Quote Originally Posted by PhilippeA View Post
    Hope It is clear that that you can help fixing…
    Looks like you're using FastLED's default WS2812 driver, which interferes with interrupts.

    The solution is to use WS2812Serial. It's a drop-in replacement, just using another include and define before you include FastLED.h, and then replace WS2812 with WS2812SERIAL in "addLeds". For an example, click File > Examples > WS2812Serial > FastLED_Cylon.

  15. #15
    Junior Member
    Join Date
    Jan 2020
    Posts
    14
    Hello,

    Sorry, the example (FastLED Cylon Example, using Non-Blocking WS2812Serial) does not compile:



    C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Phil\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Phil\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Phil\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt= o2std,keys=en-us -ide-version=10810 -build-path C:\Users\Phil\AppData\Local\Temp\arduino_build_153 094 -warnings=default -build-cache C:\Users\Phil\AppData\Local\Temp\arduino_cache_606 397 -verbose C:\Users\Phil\Documents\Arduino\libraries\WS2812Se rial-master\examples\FastLED_Cylon\FastLED_Cylon.ino
    C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Phil\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Phil\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Phil\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt= o2std,keys=en-us -ide-version=10810 -build-path C:\Users\Phil\AppData\Local\Temp\arduino_build_153 094 -warnings=default -build-cache C:\Users\Phil\AppData\Local\Temp\arduino_cache_606 397 -verbose C:\Users\Phil\Documents\Arduino\libraries\WS2812Se rial-master\examples\FastLED_Cylon\FastLED_Cylon.ino
    Using board 'teensy40' from platform in folder: C:\Program
    Using core 'teensy4' from platform in folder: C:\Program
    Detecting libraries used...
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp" -o nul
    Alternatives for WS2812Serial.h: [WS2812Serial-master]
    ResolveLibrary(WS2812Serial.h)
    -> candidates: [WS2812Serial-master]
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp" -o nul
    Alternatives for FastLED.h: [FastLED-master@3.3.2]
    ResolveLibrary(FastLED.h)
    -> candidates: [FastLED-master@3.3.2]
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp" -o nul
    Alternatives for SPI.h: [SPI@1.0]
    ResolveLibrary(SPI.h)
    -> candidates: [SPI@1.0]
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master\\WS2812Serial.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\FastLED.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\bitswap.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\colorpalettes.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\colorutils.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\hsv2rgb.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\lib8tion.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\noise.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\platforms.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\power_mgt.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master\\wiring.cpp" -o nul
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI\\SPI.cpp" -o nul
    Generating function prototypes...
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp" -o "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\preproc\\ctags_target_for_gcc_minus_e. cpp"
    "C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\preproc\\ctags_target_for_gcc_minus_e. cpp"
    Compilation du croquis...
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/precompile_helper" "C:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr/cores/teensy4" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094" "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr/cores/teensy4" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094/pch/Arduino.h" -o "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094/pch/Arduino.h.gch"
    "C:\\Program Files (x86)\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=149 -DARDUINO=10810 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094/pch" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\cores\\teen sy4" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\W S2812Serial-master" "-IC:\\Users\\Phil\\Documents\\Arduino\\libraries\\F astLED-master" "-IC:\\Program Files (x86)\\Arduino\\hardware\\teensy\\avr\\libraries\\ SPI" "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp" -o "C:\\Users\\Phil\\AppData\\Local\\Temp\\arduino_bu ild_153094\\sketch\\FastLED_Cylon.ino.cpp.o"
    In file included from C:\Users\Phil\Documents\Arduino\libraries\WS2812Se rial-master\examples\FastLED_Cylon\FastLED_Cylon.ino:5: 0:

    C:\Users\Phil\Documents\Arduino\libraries\FastLED-master/FastLED.h:14:21: note: #pragma message: FastLED version 3.003.002

    # pragma message "FastLED version 3.003.002"

    ^

    In file included from C:\Users\Phil\Documents\Arduino\libraries\WS2812Se rial-master\examples\FastLED_Cylon\FastLED_Cylon.ino:5: 0:

    C:\Users\Phil\Documents\Arduino\libraries\FastLED-master/FastLED.h: In static member function 'static CLEDController& CFastLED::addLeds(CRGB*, int, int)':

    C:\Users\Phil\Documents\Arduino\libraries\FastLED-master/FastLED.h:393:10: error: 'CWS2812SerialController' does not name a type

    static CWS2812SerialController<DATA_PIN,RGB_ORDER> controller;

    ^

    C:\Users\Phil\Documents\Arduino\libraries\FastLED-master/FastLED.h:394:19: error: 'controller' was not declared in this scope

    return addLeds(&controller, data, nLedsOrOffset, nLedsIfOffset);

    ^

    Plusieurs bibliothèque trouvées pour "WS2812Serial.h"
    Utilisé : C:\Users\Phil\Documents\Arduino\libraries\WS2812Se rial-master
    Plusieurs bibliothèque trouvées pour "FastLED.h"
    Utilisé : C:\Users\Phil\Documents\Arduino\libraries\FastLED-master
    Plusieurs bibliothèque trouvées pour "SPI.h"
    Utilisé : C:\Program
    Utilisation de la bibliothèque WS2812Serial-master prise dans le dossier : C:\Users\Phil\Documents\Arduino\libraries\WS2812Se rial-master (legacy)
    Utilisation de la bibliothèque FastLED-master version 3.3.2 dans le dossier: C:\Users\Phil\Documents\Arduino\libraries\FastLED-master
    Utilisation de la bibliothèque SPI version 1.0 dans le dossier: C:\Program Files
    Erreur de compilation pour la carte Teensy 4.0

  16. #16
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    I am not sure which version of FastLED you have. I think Paul is picking up one I fixed to work with it and have an Outstanding PR: https://github.com/KurtE/FastLED/com...1af71c0ce15ef8

    You simply need to edit one file and sort of duplicate some files included in it to match those done for T3.6 and the like.

  17. #17
    Junior Member
    Join Date
    Jan 2020
    Posts
    14
    Quote Originally Posted by KurtE View Post
    I am not sure which version of FastLED you have. I think Paul is picking up one I fixed to work with it and have an Outstanding PR: https://github.com/KurtE/FastLED/com...1af71c0ce15ef8

    You simply need to edit one file and sort of duplicate some files included in it to match those done for T3.6 and the like.

    First thank you for quick answer (faster than me)

    I think I understand better.
    Right now it is compiling but I have to make soldering on Teensy 4 to match the possible pin.
    But I am not at the end of my problem.
    Let me explain a bit more the whole project:
    I will do a led "show" in my garden using lets say 40 strips of RGB leds totalizing 15000 leds that are spreaded all over my garden (1000m2). Each strip can be composed of several strips that are combined in virtual strips so that I can outpast the 5 m length (and have simpler wiring). Thus in fact the 40 strips could be actually 60 physical strips.
    At the global system., each led is controled by its geographical position in a show is done in global. The update rate is 50 Hz
    The 40 teensy 4.0 will be located close to the strips exchanging by differential IC2 to a rapsberry that conduct the shows.
    The solution which is working (in developement) for the Teensy 4.0 is to have a cycle of 10 ms of I2C transfert + strip computation then 10 ms of parallel output the the strips leds.
    Another solution is to use non blocking transfert to led strip. I was not aware before this Morning that parallel output and non blocking were not compatible using fastled. I may consider the OctoWS2811 Library (I have to mix FASTLED function (e.g. math) with OctoWS2211 or simpler for me, is to have 2 or 3 strip in parallel using WS2812Serial: Let's say one on pin 8 plus 1 on pin 14 ?. If it works it would be the most promising as if I dream:
    - The interrupts will still work
    - the transfert on the 2 strips will be done in parallel (without using much CPU)

    Did I understand well , and is this will work ?

    Regards
    Philippe (from France)

  18. #18
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    Hopefully someone who uses this stuff can better answer. I have only done done minimal stuff, like test out a 8 or so run of some Adafruit ring of neopixels. The fix was to simply copy the T3.5/6 fixes into the T4. I verified it worked for the small case.

    So hopefully some one who does the larger runs and the like can answer any additional questions.

  19. #19
    Junior Member
    Join Date
    Sep 2019
    Posts
    6
    When using Pedros ADC library I don't see the step in the readings.

    adc->setAveraging(32); // set number of averages
    adc->setResolution(16); // set bits of resolution

    adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW _SPEED); // change the conversion speed
    adc->setSamplingSpeed(ADC_SAMPLING_SPEED::MED_SPEED) ; // change the sampling speed

  20. #20
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    Quote Originally Posted by joi View Post
    When using Pedros ADC library I don't see the step in the readings.

    adc->setAveraging(32); // set number of averages
    adc->setResolution(16); // set bits of resolution

    adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW _SPEED); // change the conversion speed
    adc->setSamplingSpeed(ADC_SAMPLING_SPEED::MED_SPEED) ; // change the sampling speed
    I am not sure what you mean by the don't see the step in the readings?

    I do know that he is sort of reducing some of the apis at the module level. to where you may have to change calls like this to something like:
    adc->adc0->setAveraging(32);
    adc->adc1->setAveraging(32);

    That is if the functions have an optional which ADC to use argument he is removing some of those apis and have you instead call using the actual underlying sub-object...

  21. #21
    Junior Member
    Join Date
    Jan 2020
    Posts
    14
    Quote Originally Posted by KurtE View Post
    Hopefully someone who uses this stuff can better answer. I have only done done minimal stuff, like test out a 8 or so run of some Adafruit ring of neopixels. The fix was to simply copy the T3.5/6 fixes into the T4. I verified it worked for the small case.

    So hopefully some one who does the larger runs and the like can answer any additional questions.
    Not a problem...I have not tested now since I am working on other topics on the projet.

  22. #22
    Junior Member
    Join Date
    Sep 2019
    Posts
    6
    The step when reading the same pin with the same pot on it with analogRead.

    See the graphs from my earlier post, there is as step or a jump in the readings around the 50% which is not the same going up or going down - that step is not present when running the same sketch with the same pot and wiring from teensy 3.0.

    The step is not there if I use the ADC library to read the pin, only with analogRead.

  23. #23
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,831
    Quote Originally Posted by joi View Post
    The step when reading the same pin with the same pot on it with analogRead.

    See the graphs from my earlier post, there is as step or a jump in the readings around the 50% which is not the same going up or going down - that step is not present when running the same sketch with the same pot and wiring from teensy 3.0.

    The step is not there if I use the ADC library to read the pin, only with analogRead.
    With Teensduino 1.49 released - if this reproduces on that version like in post #10 - this would be worthy of a new thread perhaps with notes and observations summarized there for investigation.

    Very good the ADC updated for T_4.0 doesn't show the problems!

  24. #24
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,118
    Quote Originally Posted by joi View Post
    The step when reading the same pin with the same pot on it with analogRead.
    Try adding this at the beginning of setup()?

    Code:
      pinMode(A1, INPUT_DISABLE);
    Does it help?

  25. #25
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,954
    @joi @PaulStoffregen, As mentioned, it may be worthy of a new thread if it is still an issue. I reread some of it and my guess is there is a difference in how reading directly with analogRead versus now with ADC...

    For the heck of it, you might try printing out some debug information... And try to see where the differences may be:
    That is with a stripped down version of your code (minus MIDI)
    Code:
    const int ANALOG_PIN = A1;
    
    void setup() {
      pinMode(ANALOG_PIN, INPUT_DISABLE);
      analogReadResolution(12);
    //  analogReadAveraging(32);
      Serial.begin(38400);
      int analog_value = analogRead(ANALOG_PIN);
      Serial.printf("CFG:%x, GC:%x, HC0:%x, R0:%x\n", ADC1_CFG, ADC1_GC, ADC1_HC0, ADC1_R0);
    }
    
    void loop() {
    
      float value = (float)analogRead(ANALOG_PIN);
      Serial.print(value);
      Serial.print('\n');
    
      delay(100);
    }
    And I see some of the initial setup like:
    Code:
    CFG:7bb, GC:20, HC0:8, R0:809
    2056.00
    2050.00
    2057.00
    2059.00
    2056.00
    2056.00
    Have you tried setting ReadAveraging? That changes config, like:

    Code:
    CFG:c7bb, GC:20, HC0:8, R0:807
    With a hacked up version of ADC readPin (removed reading from ADC_1 (ADC2)...
    Part of setup for it looks like:
    Code:
     ///// ADC0 ////
      adc->setAveraging(16); // set number of averages
      adc->setResolution(12); // set bits of resolution
      adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED); // change the conversion speed
      adc->setSamplingSpeed(ADC_SAMPLING_SPEED::MED_SPEED); // change the sampling speed
    
      int value1 = adc->adc0->analogRead(readPin);
      Serial.printf("CFG:%x, GC:%x, HC0:%x, R0:%x\n", ADC1_CFG, ADC1_GC, ADC1_HC0, ADC1_R0);
    Code:
    CFG:180f9, GC:20, HC0:8, R0:808
    Pin: 15, ADC0 value: 1.6568498168
    
    Pin: 15, ADC0 value: 1.6560439560
    
    Pin: 15, ADC0 value: 1.6568498168
    So it may be interesting to experiment some with the different CFG values and see if we need to change some of the equivalent values for conversion speed and sampling speed?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •