Forum Rule: Always post complete source code & details to reproduce any issue!
Page 130 of 151 FirstFirst ... 30 80 120 128 129 130 131 132 140 ... LastLast
Results 3,226 to 3,250 of 3755

Thread: Teensy 4.0 First Beta Test

  1. #3226
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    ANALOGREFERENCE

    Alcon, need a sanity check on the analog reference before I go crazy. I reread the section 65.5.2 in the RM on the Ref Voltage and the ADC_CFG[REFSEL] register. But looking REFSEL you only have one option, Vrefh and Vrefl, others choices are reserved. Then in the begining of the ADC section, "VREFH / VREFL are bonded to VDDA_ADC_3P3 / GND, on this device".

    So if I am interpreting correctly, you can't change the analogreference like you can with the T3x

  2. #3227
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    @mjs513 and ... Not sure how much help I can be with some of the Analog things... But will give my $.02 worth of comments

    Hopefully someone who uses it more, can give hopefully give at least $.03

    AnalogReference - Your guess is better than mine! But I think I am reading it the same way...

    I do remember some discussions, about the analog capabilities are not as capable as T3, maybe trading off higher speeds and the like...

    Things like:
    T3.x can give up to 16 bit resolution, where these only 12 bit.
    T3.x has some differential like stuff, not sure here about T4
    Number of Inputs?
    The 3.6 talks about Up to four pairs of differential and 24 single-ended external analog inputs
    The 4 mentions: Up to 10 ENOB (dedicated single ended channels) and Up to 8 single-ended external analog inputs - Not sure difference

    In some comments yesterday I asked about having special logical pins for Temp and VREF, like we have for T3.x...

    Not sure if we can do for Temp, as on T3.x It is an actual actual Analog channel, example 26 first ADC on T3.6 on T4, I don't see any and there is a complete other chapter on Temperature monitoring. Could maybe hack up analog.c to detect special case and call over to temp monitoring code?

    VRef: On T3.6 we use channel 18 on ADC1 which is: VREF Output/ADC1_SE18... Not sure if on T4 if setting: 11001 VREFSH = internal channel, for ADC self-test, hard connected to VRH internally Would give us anything?
    Also not sure about ADC_ETC Stuff...


    Again sorry, not much help.

  3. #3228
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,221
    Quote Originally Posted by defragster View Post
    I just hit the USBHost logger_RawWrite sketch and ...\libraries\uSDFS\src\utility\ff_utils.c needs some work on the Time with the update 1062 bootloader v4. I hacked it enough to compile - but not quite a valid time string ….
    Update:
    modified uSDFS to handle RTC also for T4

  4. #3229
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    @KurtE - first, you are always a lot of help and give me a lot of background that I don't have. As for your other comments....

    Right not functions for AnalogResolution and AnalogAverging are all operational for the Analog pins that are broken out. Not sure what the difference is between ENOB and single-ended external channels either. This is the first time I ever got down into the nuts and bolts of ADC. As for differential I don't remember seeing anything in the RM about it but … I know it does have compare capability.

    Not sure if we can do for Temp, as on T3.x It is an actual actual Analog channel, example 26 first ADC on T3.6 on T4, I don't see any and there is a complete other chapter on Temperature monitoring. Could maybe hack up analog.c to detect special case and call over to temp monitoring code?
    To be honest not sure its really worth it - when to get internal temp all you have to do in any sketch is do a: tempmonGetTemp(), results in deg C. We could do a hack it would be convoluted because wouldn't you expect it come out in counts, then the user has to do the conversion? Don't know never tried it on the T3.x

    VRef: On T3.6 we use channel 18 on ADC1 which is: VREF Output/ADC1_SE18... Not sure if on T4 if setting: 11001 VREFSH = internal channel, for ADC self-test, hard connected to VRH internally Would give us anything?
    Also not sure about ADC_ETC Stuff...
    Yeah, I saw that as well but I think you need to put ADC into set test mode which would defeat the purpose I think. A little lost in the woods now with this one.

    Anyway, thanks for the sanity check on the interpretation.

    EDIT: Forgot, @manitou put up a sample sketch if I remember right for ADC_ETC.

  5. #3230
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,000
    Quote Originally Posted by mjs513 View Post

    EDIT: Forgot, @manitou put up a sample sketch if I remember right for ADC_ETC.
    I have examples using internal DAC to do ADC compare, and using ADC_ETC to do timed ADC reads, and free-running ADC with double-buffered DMA, BUT i never found a way to do what audio lib needs: timed ADC with double-buffered DMA

  6. #3231
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,221
    MSC on T4 with latest TD?
    Does someone from the MSC thread have MSC running with latest TD update?
    In my case my program logger_RawWrite stops when writing the first data buffer (64 blocks)
    I use a SSD disk with DIGITUS USB2 to SATA II adapter
    I worked previously (when we were working on other thread)

    Solved it (have nearly forgotten about it)
    There needs to be a correction in "hardware\teensy\avr\libraries\USBHost_t36\ehci.cp p" line 748 to read
    Code:
    for (count=((len-1) >> 14); count; count--)
    See https://forum.pjrc.com/threads/55821...l=1#post205836
    Last edited by WMXZ; 06-08-2019 at 04:27 PM.

  7. #3232
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    RadioHead - Appears to work for RFM95

    However did not allow SPI1 and SPI2 to be used, so updated code to allow this: https://github.com/PaulStoffregen/RadioHead/pull/31

    I have the simple Client Server code running with rfm95_client running on T4 on SPI - Had to remember to do a few edit changes: to set frequency...

    I have it talking to one of my own boards for T3.6 on SPI1 which is running rfm95_server

    And the two are talking.

  8. #3233
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    Quote Originally Posted by KurtE View Post
    RadioHead - Appears to work for RFM95

    However did not allow SPI1 and SPI2 to be used, so updated code to allow this: https://github.com/PaulStoffregen/RadioHead/pull/31

    I have the simple Client Server code running with rfm95_client running on T4 on SPI - Had to remember to do a few edit changes: to set frequency...

    I have it talking to one of my own boards for T3.6 on SPI1 which is running rfm95_server

    And the two are talking.
    @KurtE - nice catch Kurt. Only tested SPI never thought about SPI1/2. PS. Ordered some breadboard pushbuttons to test USB joystick etc....

  9. #3234
    @WMXZ

    Downloaded TD4.17B3 and installed a fresh copy of Arduino 1.89 Updated uSDFS to your latest version.
    I ran 'logger_RawWrite.ino' on my seven different HD's and they are averaging 7.5MBs. Very consistent for all those drives. (Except for the one that I did not have the write cache turned on).

    When compiling 'logger_RawWrite_FS.ino' though I am getting following compile error:
    Code:
    /home/wwatson/arduino-1.8.9/arduino-builder -dump-prefs -logger=machine -hardware /home/wwatson/arduino-1.8.9/hardware -hardware /home/wwatson/.arduino15/packages -tools /home/wwatson/arduino-1.8.9/tools-builder -tools /home/wwatson/arduino-1.8.9/hardware/tools/avr -tools /home/wwatson/.arduino15/packages -built-in-libraries /home/wwatson/arduino-1.8.9/libraries -libraries /home/wwatson/Arduino/libraries -fqbn=teensy:avr:teensy4b2:usb=serial,opt=o3std,keys=en-us -ide-version=10809 -build-path /tmp/arduino_build_114602 -warnings=none -build-cache /tmp/arduino_cache_382777 -verbose /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite_FS/logger_RawWrite_FS.ino
    /home/wwatson/arduino-1.8.9/arduino-builder -compile -logger=machine -hardware /home/wwatson/arduino-1.8.9/hardware -hardware /home/wwatson/.arduino15/packages -tools /home/wwatson/arduino-1.8.9/tools-builder -tools /home/wwatson/arduino-1.8.9/hardware/tools/avr -tools /home/wwatson/.arduino15/packages -built-in-libraries /home/wwatson/arduino-1.8.9/libraries -libraries /home/wwatson/Arduino/libraries -fqbn=teensy:avr:teensy4b2:usb=serial,opt=o3std,keys=en-us -ide-version=10809 -build-path /tmp/arduino_build_114602 -warnings=none -build-cache /tmp/arduino_cache_382777 -verbose /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite_FS/logger_RawWrite_FS.ino
    Using board 'teensy4b2' from platform in folder: /home/wwatson/arduino-1.8.9/hardware/teensy/avr
    Using core 'teensy4' from platform in folder: /home/wwatson/arduino-1.8.9/hardware/teensy/avr
    Detecting libraries used...
    /home/wwatson/arduino-1.8.9/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=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_114602/sketch/logger_RawWrite_FS.ino.cpp -o /dev/null
    /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite_FS/logger_RawWrite_FS.ino:254:24: fatal error: sd_config.h: No such file or directory
    compilation terminated.
    Error compiling for board Teensy 4-Beta2.
    If I copy sd_config.h directly to the src directory it compiles up to this error:
    Code:
    /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite_FS/logger_RawWrite_FS.ino:446:55: warning: format '%d' expects argument of type 'int', but argument 4 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
    logger_RawWrite_FS: In function 'void rtc_init()':
    logger_RawWrite_FS:487: error: 'SNVS_LPSR_PGD_MASK' was not declared in this scope
       SNVS_LPSR = SNVS_LPSR_PGD_MASK;
                   ^
    logger_RawWrite_FS:491: error: 'SNVS_LPCR_LPTA_EN_MASK' was not declared in this scope
       SNVS_LPCR &= ~SNVS_LPCR_LPTA_EN_MASK; // clear alarm
                     ^
    Using library uSDFS at version 1.1.2 in folder: /home/wwatson/Arduino/libraries/uSDFS 
    Using library USBHost_t36-PS3_Motion_WIP2-Bluetooth at version 0.1 in folder: /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36-PS3_Motion_WIP2-Bluetooth 
    Using library MSC at version 1.0.0 in folder: /home/wwatson/Arduino/libraries/MSC 
    'SNVS_LPSR_PGD_MASK' was not declared in this scope
    I am probably missing something.

  10. #3235
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,221
    Quote Originally Posted by wwatson View Post
    @WMXZ
    I am probably missing something.
    Must still clean up the "_FS.ino" examples (sorry)

  11. #3236
    Understandable, lot's going on right now. I am having a hard time keeping up with all the changes. Need more free time

  12. #3237
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,795
    Quote Originally Posted by wwatson View Post
    Understandable, lot's going on right now. I am having a hard time keeping up with all the changes. Need more free time
    That came with the latest T4 bootloader update with the RTC started and set during upload. So those services are now native available in some fashion. Recent post manitou published and I edited replublished a RTC time sample - not sure if that is the answer - it returns time: See " time_t tt = rtc_get(); "

  13. #3238
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,221
    Quote Originally Posted by wwatson View Post
    @WMXZ

    I am probably missing something.
    Removed all RTC code as this is now done with TD (I assume also for T3.x)
    Also the access to sd_config.h is removed

  14. #3239
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    I thought I might take a quick look at some of the avr_emulation code for SPI that is not currently implemented.

    I hope it is fine, but I am finding that some of this code is using some of the functions like: void serial_print(const char *p);
    to print out stuff to Serial1... So I defined a few of these in HardwareSerial.h and implemented them in HardwareSerial1.cpp

    They are defined in the extern "C" block of the header file so should be defined as C bindings...

    Note: These changes are in the branch I have that is part of the SerialEvents/main Pull Request

  15. #3240
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    @mjs513 and...
    Quote Originally Posted by mjs513 View Post
    @KurtE - nice catch Kurt. Only tested SPI never thought about SPI1/2. PS. Ordered some breadboard pushbuttons to test USB joystick etc....
    I would have probably missed it as well, except my T3.6 board uses SPI1 and I tried to compile the edited version of the simple client/server I previously updated to run on SPI1...

    Edit: Will later try the SPI1 code on T4, when my break out board arrive from Seeed... They shipped and I do have setup to solder on RFM95 on SPI1. But not sure yet, may wait until I can buy a T4 as it will require me to solder on the surface mount connectors like we have on T3.x... And not sure if I want to risk the current test board, as I won't be able to then take it out and plug into PJRC breakout board.

    As for USB Joystick, testing, I may try to simply use one of the Arbotix Commanders (shield), that I have as part of my Trossen stuff:


    It has two thumb like axis, plus 8 buttons, and they ship it plugged into an Seeedstudio simple Arduino board (runs at 3.3v) So should be easy to try out, especially if you have a T4 board with Arduino shield connectors

  16. #3241
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    @KurtE
    Trossen has some nice stuff I see - never saw that before though. Going to be interesting. Figure with the push buttons and thumb pots I might be able to test a couple of more things. The new version of my breakout board is coming next week (DHL holdup) so will have to play and test that with the SMD components - going to be fun soldering. I am using the T4B2 with the brownout fix mainly for the same reason you stated - didn't want to ruin it so I couldn't use it for testing in Paul's breakout which I really like

  17. #3242
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    Quote Originally Posted by mjs513 View Post
    @KurtE
    The new version of my breakout board is coming next week (DHL holdup) so will have to play and test that with the SMD components - going to be fun soldering. I am using the T4B2 with the brownout fix mainly for the same reason you stated - didn't want to ruin it so I couldn't use it for testing in Paul's breakout which I really like
    Sounds good - Mine shipped From Seed on 6/4, but update says that today: Depart from facility to service provider. (USPS) Not sure how long it will take....

    I probably should do a parts list and make an order to have at least some of the parts on hand... Sort of figure I may have some time... Again not sure when T4 will ship, but I can probably sacrifice the older T4B2, although it does not have the same SD connector so probably would not hook up that part.

  18. #3243
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    @KurtE, @defragster, @Frank B, etc

    Last night I was looking for stuff on Arduino or Teensy with HDMI and came across a shield somebody designed for to out HDMI from a Teensy 3.5/3.6. While not directly related to the T4 thought I would post it here as a FYI. Heres a link to the YouTube video, https://www.youtube.com/watch?v=MUeIY_gLn3c, the interesting piece on the T3.5/3.6 starts at 2:55.

  19. #3244
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    @all
    I thought I would look at the loop timing, with how much time is being used, in particular how much time is added by calling yield() and where the time is used and how to make quicker...

    Right now playing with simple sketch:
    Code:
    uint32_t start_time;
    int loop_counter = 0;
    elapsedMicros micros_timer = 0;
    void setup() {
      pinMode(13, OUTPUT);
      while (!Serial) ;
      Serial.begin(115200);
      micros_timer = 0;
      start_time = micros();
      for (loop_counter = 0; loop_counter < 1000; loop_counter++) {
        digitalWriteFast(13, !digitalReadFast(13));
      }
      uint32_t dt = micros()-start_time;
      Serial.printf("For: %d %d\n", dt, micros_timer);
      delay(1000); // give lots of time to print...
      loop_counter = 0;
      micros_timer = 0;
      start_time = micros();
    }
    
    
    void loop() {
      digitalWriteFast(13, !digitalReadFast(13));
      loop_counter++;
      if (loop_counter == 1000) {
        uint32_t dt = micros()-start_time;
        Serial.printf("Lop: %d %d\n", dt, micros_timer);
        delay(1000); // give lots of time to print...
        loop_counter = 0;
        start_time = micros();
        micros_timer = 0;
      }
    }
    And finding either elapsedMicros is not working or I am not using it right...

    Doing some comparisons of time to do the 1000 iterations of the digitalWriteFast(13, !digitalReadFast(13))

    The one called in setup in a straight loop is taking: 26 us
    Loop not calling yield: 72
    Loop calling yield but yield does nothing: 96
    Yield only calls EventResponder::runFromYield() : 137
    Add quick check at start of runFromYield ( if (!firstYield) return: 102
    Will add to my PR...

    Now add back: if (usb_enable_serial_event_processing && Serial.available()) serialEvent(); Plus the no recursion code: that is Yield is:
    Code:
    void yield(void)
    {
    	static uint8_t running=0;
    
    	if (running) return; // TODO: does this need to be atomic?
    	running = 1;
    
    
    	// USB Serail - Add hack to minimize impact...
    	if (usb_enable_serial_event_processing && Serial.available()) serialEvent();
    
    	running = 0;
    	EventResponder::runFromYield();
    	
    };
    The (usb_enable_serial_event_processing is a hack I put in to the default SerialEvent which turns it off)
    Run with: 145 If I enter something in Serial Monitor: 131

    Now if I add back in the call to the HardwareSerial:rocessSerialEvents();
    right after the USB test code: It jumps back up to: 163 (Down to 150 if Character entered in USB...)

    Now if I move the check to see if there are any SerialEvent functions active from the processSerialEvents
    into making the call conditional within yield: 154(153 alternating) and 139 after usb key in...
    So may also Make that change as well...

    As for elapsed Micros I probably should take a look, here is extract of the last run:
    Code:
    For: 26 536877268
    Lop: 153 536877268
    Lop: 153 536877268
    Lop: 153 536877268
    Lop: 154 536877268
    Lop: 154 536877268
    Lop: 153 536877268
    Lop: 139 536877268
    Lop: 139 536877268
    EDIT: elapsedMicros - issue was not with it, but simply using in Serial.printf.

    That is if I change first print to: Serial.printf("For: %d %d\n", dt, (uint32_t)micros_timer);
    It works fine
    Last edited by KurtE; 06-09-2019 at 03:03 PM. Reason: elapsedMicros - does work...

  20. #3245
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,795
    PHEW - That is Good that elapsedMicros is healthy - it runs off the ARM_CycCnt micros() . Yeah - (casting) shows up in those warning notes that scroll off in the verbose compile cloud.

    Just remembered one other old tidbit reading that - need to find/test the sketch - where DigRead/Write had diff timings on 1052 depending on if there was a 1 or a 0 involved in the state in some fashion.

    @mjs513 and HDMI - big board - but cool: github.com/techtoys/HDMI-Shield/tree/master/Ra8876_Lite
    Teensy 3.2 and 3.5 with a simple stacker PCB (Teensy Stacker DTE20171030). Teensy is providing the best Audio library for Arduino platform in my opinion. WAV file playback is used in the example Ra8876_allegro_bruce_xflash.ino for a very famous Bruce Lee movie sound track as the background music while three gif animations are played. You will need a HDTV or FHD monitor with HDMI interface to hear this.

  21. #3246
    @mjs513 - This is what I am using with my T36 configured for SPI: https://www.buydisplay.com/default/s...tl-touch-panel
    It also uses the RAIO RA8876 display controller with XPT2046 touch screen. My software driver is a heavily modified version of RA8876_Lite. The controller board is mounted behind the display.
    I want to adapt this for use with the T4. Hopefully this not off topic. This display has the same MISO tristate problem as the RA8875. So at this point I am using all three SPI ports on the T36. One for the display, one for the touch screen and one for use with WIFISPI and the ESP8266.

  22. #3247
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    4,869
    Hi @wwatson - It has been awhile since we played with it, but Mike does have the driver: https://github.com/mjs513/ILI9488_t3
    Which I believe I tested on SPI2 of the T4 (I think it was with the T4B1...) maybe should retry again with T4B2 (Cable version).

    I used a Sparkfun SDCard breakout adapter to get access to the IO pins and then tried it out. I have not tried it yet on SPI1 as I don't have breakout board which had easy access to all of the bottom SMT pads.

    I also have the ability to use Flex IO pins to create another SPI port, May not be great for display, but probably could easily be used for touch...

  23. #3248
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    @degragster - yes its a big but no bigger than an Arduino Uno and it does use 3.3v so should work with the T4. Right now the website shows that it does not have any available but I contacted the gentlemen and he said he a few left so trying to get one to test with the T4. Just can't resist the lure of hooking up the T4 to a HDMI screen.

    @wwatson/@KurtE - nice setup, only just got into the displays stuff when I started with playing with the ILI9488_t3 library with @KurtE so never even heard of the RA8875 stuff before so looks like its going to be interesting to get it too work. As for the tristate issue - haven't had time to play with it to see if I could get it too work with the one of those tristate buffers - maybe that will be the next project - right other distractions got my attention today and probably tomorrow.

    Same here on testing of the ILI9488 display on SPI1 - only tested it on SPI and SPI2. But it is configured that you can use SPI1. Same with ILI9341_t3n.

  24. #3249
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,795
    @wwatson/@KurtE - the Touch on the 9488 I had was tri-stated safe - so it could share SPI with other and it was only the MISO on 9488 that was trouble when needed to read the display. Thought the _isr INT detect was a bit odd perhaps - maybe that was 1052 testing - or how it was hacked to work … one more thing to revisit.

    @mjs513 - Big for the HDMI is relative - given it gets to an HDMI screen of rPi size or big screen. Nice that uses a supported controller interface - should be cleaner and better than analog VGA where it loaded the MCU (pins and timing) and got digital noise in the signal. Good you found availability details - hopefully cost effective and they make more?

  25. #3250
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,471
    @defragster - from what I read it's about $61 dollars for the shield but it also ships with a stm32 something or other that goes between the Arduino and the Shield. If you use a teensy you don't need that extra piece. Think he wrote something in the youtube comments about looking at a redesign for improvements and easier production. The company is in Hong Kong.

Posting Permissions

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