1st Teensy 4.0 try

Status
Not open for further replies.

jesusangel

Active member
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
 
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
 
Maybe, so why are these examples enable to try in Examples for Teensy 4?

Screenshot_1.jpg
 
Last edited:
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
 
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.
 
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);
}
 
Status
Not open for further replies.
Back
Top