Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: 1st Teensy 4.0 try

  1. #1
    Junior Member
    Join Date
    Oct 2015
    Posts
    4

    1st Teensy 4.0 try

    Hi, I have a project with Teensy 3.2, in last order I purchased the new teensy 4.0 to try with this project, but it fails to compile with i2c, so I tried a new Arduino IDE installation and the sample code for Teensy 4 and i2c_t3 with the same error, 'Wire' was not declared. Tested Arduino 1.8.8 and 1.8.9 none is working.

    Code:
    basic_scanner: In function 'void setup()':
    basic_scanner:28: error: 'Wire' was not declared in this scope
         Wire.begin(I2C_MASTER, 0x00, I2C_PINS_18_19, I2C_PULLUP_EXT, 400000);
    Am I missing something exposed in other thread or place?

    Regards

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,201
    as the name i2c_t3 implies, that lib is only for the Teensy 3*. No equivalent yet for the Teensy 4. You will need to use the standard I2C lib Wire.h

  3. #3
    Junior Member
    Join Date
    Oct 2015
    Posts
    4
    Maybe, so why are these examples enable to try in Examples for Teensy 4?

    Click image for larger version. 

Name:	Screenshot_1.jpg 
Views:	14 
Size:	87.4 KB 
ID:	17588
    Last edited by jesusangel; 09-13-2019 at 06:38 PM.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,598
    i2c_t3 doesn't work on Teensy 4.0. You need to use the regular Wire library.

  5. #5
    Junior Member
    Join Date
    Oct 2015
    Posts
    4
    Ok, thank you, few things to change to port from 3.2 to 4.0, reading mac address doesn't work either.

    Code:
    void read_EE(uint8_t word, uint8_t *buf, uint8_t offset)  {
      noInterrupts();
      FTFL_FCCOB0 = 0x41;             // Selects the READONCE command
      FTFL_FCCOB1 = word;             // read the given word of read once area
    
      // launch command and wait until complete
      FTFL_FSTAT = FTFL_FSTAT_CCIF;
      while (!(FTFL_FSTAT & FTFL_FSTAT_CCIF))
        ;
      *(buf + offset + 0) = FTFL_FCCOB4;
      *(buf + offset + 1) = FTFL_FCCOB5;
      *(buf + offset + 2) = FTFL_FCCOB6;
      *(buf + offset + 3) = FTFL_FCCOB7;
      interrupts();
    }
    One off topic question Paul, have you in mind to stop manufacturing 3.2?. I'm selling a project with this one, sold few hundred of devices in last years, so I have to foresee what to do in next months with 3.2 , maybe get a lot of stock until I get forced to port to 4.0 definitely.

    Regards

  6. #6
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,899
    I am not PJRC but with the end of life Question, Paul still has kept the T2 models in production alongside the T3 series, and the T3.2 fulfills a different need than the T4.0. from posts elsewhere stated intention is to keep the 3.2 in production for as long as people buy it, main risk is NXP deciding to cease making the core which is outside PJRC control. If planning a business suggest keeping an eye on https://www.nxp.com/part/MK20DX256VLH7 for messages about the NXP ceasing production, which is probably good practice for any single source part in a commercial product.

  7. #7
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,201
    Quote Originally Posted by jesusangel View Post
    Ok, thank you, few things to change to port from 3.2 to 4.0, reading mac address doesn't work either.
    see https://forum.pjrc.com/threads/57595...ess-Teensy-4-0

    Serial.printf("MAC %04X%08X\n", HW_OCOTP_MAC1, HW_OCOTP_MAC0);

  8. #8
    Junior Member
    Join Date
    Oct 2015
    Posts
    4
    Thank you to all, keep on migrating.

    Works :
    I2C LCD
    SPI Flash Memory

    Doesn't Work:
    Reset by software
    WatchDog

    To Test:
    iButton
    RFID

    I made a soft reset with code SCB_AIRCR = 0x05FA0004; but it hangs

    With the wathdog I get :

    Code:
    'WDOG_REFRESH' was not declared in this scope
    When compiling with

    Code:
    void KickDog()
    {
      noInterrupts();
      WDOG_REFRESH = 0xA602;
      WDOG_REFRESH = 0xB480;
      interrupts();
      delay(1);
    }

  9. #9
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,201
    Re: watchdog
    from T4-beta-testing thread https://github.com/tonton81/Watchdog_t4

  10. #10
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,119
    Yes software reset is a known problem - was discussed over on this thread:
    https://forum.pjrc.com/threads/57553...ght=0x05FA0004
    Last edited by defragster; 09-19-2019 at 08:02 PM. Reason: search test grapefruit

Posting Permissions

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