Missing the kinetics.h from Teensy 4.0/4.1

Markus_L811

Well-known member
Hello,

I wonder if I missed something but I was looking for the kinetics.h inside the teensy 4 core like inside the teensy 3 core but there is nothing where did it went?

B.R.
Markus
 
SO many files and details - easy to get focused and miss the tree for the forest - I used global search in editor SublimeText to get the hit.
 
I have run into the same problem (compiler can't find kinetics.h) but I'm afraid the response above does not clarify what I have to do to rectify the situation. I can confirm that I have imxrt.h in my core and it appears to contain kinetics but what do I do now to link code and complete?
(I'm a hobbyist and don't fully understand (yet) some of these 'deeper' system type issues.)
Thanks
 
I have.

A little more info I should have included earlier:
Teensy 4.1
Teensduino 1.57
Arduino 1.8.13

The sketch I am trying to run is a unmodified copy of 'fast data logger' (can't find the original). It includes SdFat.h and RingBuf.h. When trying to compile, the error message is ".......kinetics.h: no such file or directory".

I can post full code if that helps.
 
kinetis.h is Teensy 3.x (and LC) specific. So, your code should not be including it. As it won't be found.

Beyond that, hard to say, much as we don't have anything to go on, except the sketch name is fast data logger,
but that is a generic name, so could be from an SDFat like project, or MTP, or...

And we don't see the actual error message, which will probably tell us who included Kinetis.h
And for example, the compiler output might give additional hints, like maybe it included an old version of SD library or???
 
Thanks for the responses.

Code attached (I hope I've done this correctly - 1st timer). The code is as I obtained it except for the first 16 comment lines which I have added to capture what I am trying to achieve. The reasons for selecting this code as a starting baseline is that is fast (>> the 2kHz sample rate I need) and I have a chance to understand the code so that I can adapt it as I require.

Regards

Code:
/* MDS Oct 22
 *  TeensyLogger - a high speed data logger initially intended to record current profile for Gerald's Bumper Car
 *  
 *  The objective is to use a current trnasformer (CT) to measure the current taken by a car on the track to assess 
 *  real load current and, in particular, overload current at motor start up.  A 1v/100A CT provides an analogue voltage
 *  to the Teensy 4.1.  This is sampled at high rate (tbc but nominally 500usec between samples) for 10seconds and stored 
 *  on the T4.1's SD card.  A Bluetooth link provides a means to start/stop recording and replay the data using a mobile phone.
 *  

  Start points are:
      20samples per 50Hz 1/2 cycle (0.5usec.)
      steady state motor current 6.25A (500W at 80v)
      Overload/start up motor current 62.5A (x10)
      Analogue input resolution = 3/3v/1025 = 3.22mV
      1V/100A = 10mV/A
      input FSD = 3.3V = 330A (may exceed CT's ability or linearity)
      to minimise 'lost time/data' whilst data is saved, samples will have to be saved on batches/blocks (using SdFat and possibly PIFFS)

   This example code is in the public domain.
*/

int Tstart;//recording start time reference
int Ival = 500;//current value (0 - 1024)
int cnt;
int led = 13;
bool LED = LOW;
elapsedMillis whiletime;
DataT = 10000;//sets the recording time (in ms)

void setup()
{                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  Serial.begin(9600);
  Serial.print("getting started.....");
}


void loop() 
//loop structure contains:
//inputs via BT to start recording/saving samples, replay data to BT for display
//a 10sec 'do..while' call to collect samples and store them
{
  Tstart = whiletime;
  cnt = 0;
  //set the LED to show recording is activated

  
  //collect and save samples
  while (whiletime <= Tstart + DataT){
    Ival = analogRead(0);
    cnt = cnt + 1;     
  }

  Serial.print("out of while.....");
  Serial.print("analog 0 is: ");
  Serial.println(Ival);
  Serial.print("Number of reads in 10sec. =  ");
  Serial.println(cnt);
  
  if(LED == HIGH){
    digitalWrite(led, LOW);
    LED = LOW;
  }
  else {
    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
    LED = HIGH;
  }

}
 
I compiled that code for a T4.1 using Arduino 1.8.19 and Teensyduino 1.57_b4.
There's an error because DataT is not declared. When I declare it as int, the code compiles - no complaint about missing kinetics.h

Pete
 
p#12 code compiled here - with exception of
Code:
C:\T_Drive\tCode\FORUM\CompileTest\CompileTest.ino:30:1: error: 'DataT' does not name a type
 DataT = 10000;//sets the recording time (in ms)

Made that a uint32_t and it built.

The usage of " elapsedMillis whiletime; " is a bit non-standard, perhaps confused?

Only a single Ival is holding the last analogRead() value and it reads for 10,000 ms? So just testing the number of reads in 10 seconds:
Code:
int Ival = 500;//current value (0 - 1024)
int cnt;
int led = 13;
elapsedMillis whiletime;
uint32_t DataT = 10000;//sets the recording time (in ms)

void setup()
{
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  Serial.begin(9600);
  while (!Serial && millis() < 4000 );
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
  Serial.print("getting started.....");
}


void loop()
//loop structure contains:
//inputs via BT to start recording/saving samples, replay data to BT for display
//a 10sec 'do..while' call to collect samples and store them
{
  whiletime = 0;
  cnt = 0;
  //set the LED to show recording is activated

  //collect and save samples
  while (whiletime <= DataT) {
    Ival = analogRead(0);
    cnt = cnt + 1;
  }

  Serial.print("out of while.....");
  Serial.print("analog 0 is: ");
  Serial.println(Ival);
  Serial.print("Number of reads in 10sec. =  ");
  Serial.println(cnt);

  digitalToggle(led);
}

Set of whiletime to 0 will then count ms up to end the while without another intermediate variable to set and compare.
Code:
C:\T_Drive\tCode\FORUM\CompileTest\CompileTest.ino Nov  2 2022 14:29:53
getting started.....out of while.....analog 0 is: 13
Number of reads in 10sec. =  569754
out of while.....analog 0 is: 13
Number of reads in 10sec. =  569754
...
 
Thanks el_supremo and defragster - your input is much appreciated.

However, this still leaves me with the 'can't find kinetis.h issue', which takes me back to Markus-L811's original query and defragster's response "... look into :: hardware\teensy\avr\cores\teensy4\imxrt.h:". I can find lmxrt.h in my T_4.2 core and note that its content looks very to contain kinetis.h code, however, I'm not sure what Markus_811 did when he found his lmxrt.h - what could he do?. It seems possible that there is an error somewhere in my Arduino or Teezyduino (??). Any thoughts would be appreciated. My Teenzyduino was installed last week so should be very current, so I will update Arduino the the latest 1.8.19 (I believe 2.0 is now released but that might introduce more issues than it solves) and try that.

Regards
 
However, this still leaves me with the 'can't find kinetis.h issue',

Hopefully you can also understand this leaves all of us with "can't reproduce kinetis.h issue". The code you gave us in msg #12 has a different error, but does not give the kinetis.h error, even when that other error is fixed.

Maybe use a text edit (like Notepad on Windows). Copy the code there. Then open a new window in Arduino, delete the placeholder code it puts into every new window, then copy and paste the code from the text editor (as we will do from this forum) into that empty Arduino window and click Verify.

If it really does reproduce this error, then copy and paste that same code into a message here.
 
And also, if it does still reproduce. Then copy in the error messages as well as the other information at the end of the build:

Example of such data:
Code:
Memory Usage on Teensy MicroMod:
  FLASH: code:134700, data:43016, headers:8648   free for files:16328708
   RAM1: variables:70848, code:129096, padding:1976   free for local variables:322368
   RAM2: variables:12384  free for malloc/new:511904
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\teensy\\tools\\teensy-tools\\0.58.2/stdout_redirect" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino-sketch-F648251CB6BEFB58E6D8C6A22AB256FD/USBHost_viewer.ino.lst" "C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\teensy\\tools\\teensy-compile\\11.3.1-beta1/arm/bin/arm-none-eabi-objdump" -d -S -C "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino-sketch-F648251CB6BEFB58E6D8C6A22AB256FD/USBHost_viewer.ino.elf"
Multiple libraries were found for "USBHost_t36.h"
  Used: D:\github\USBHost_t36
  Not used: C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.2\libraries\USBHost_t36
Multiple libraries were found for "SdFat.h"
  Used: D:\github\SdFat
  Not used: C:\Users\kurte\Documents\Arduino\libraries\SdFat_-_Adafruit_Fork
  Not used: C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.2\libraries\SdFat
Using library USBHost_t36 at version 0.2 in folder: D:\github\USBHost_t36 
Using library SdFat at version 2.1.2 in folder: D:\github\SdFat 
Using library SPI at version 1.0 in folder: C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.2\libraries\SPI 
Using library EEPROM at version 2.0 in folder: C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.2\libraries\EEPROM 
Using library ILI9341_t3n at version 1.1.0 in folder: D:\github\ili9341_t3n 
"C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\tools\teensy-tools\0.58.2/teensy_post_compile" "-file=USBHost_viewer.ino" "-path=C:\Users\kurte\AppData\Local\Temp\arduino-sketch-F648251CB6BEFB58E6D8C6A22AB256FD" "-tools=C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\tools\teensy-tools\0.58.2" "-board=TEENSY_MICROMOD" -reboot "-port=usb:0/140000/0/8/1/1" "-portlabel={serial.port.label}" "-portprotocol={serial.port.protocol}"
Note: You won't see the first part of what I posted, if you build does not compile without errors.

But this type of information, lets us know which libraries you are using and what other ones that were not choosen.

My gut tells me, the program you posted is not the full complete sketch as you mention the sketch as being a data logger. and storing the data.
Yet I don't see anything actually storing the data. Unless you mean just output some information to a serial port.

Also if it were me, I would probably install the current version of Arduino. Either 1.8.19 or the new IDE 2.0.1 and then install Teensyduino. on this and see if that helps.
 
Hi Paul & KurtE,

I really appreciate the time and effort you have given me. I also acknowledge that as you can't replicate the problem it is difficult to provide a conclusive response.

I will try the points you raise in your feedback and I will, in return, provide feedback on what changes the actions provide (but probably not for a day or 2).

Additionally, I have reconsidered my strategy. Originally I intended to measure current (the voltage from a current transformer) 40 times per mains power cycle over a 10 second period (hopefully longer). This gives 20,000 2byte samples, hence the need for a fast data logger with data saved to an SD card. The issue with data logging (given my limited software skills) is to follow/adapt the code I've seen for fast data saving on SD (e.g. involving blocks, ring buffers). My base requirement is to measure the peak current as a motor accelerates from a 0rpm/stalled condition. I am now considering identifying the peak analogue value every 1/2 cycle and record these values. Ergo, store 20 samples every 1/2 cycle in an array (20 2-byte values), choose the maximum value and store it in another array which requires 1 value every 1/2 cycle over 10 seconds (1,000 2-byte values). This array would be stored on SD without time constraints and/or output via bluetooth to a mobile device for display.

Regards,
 
Hi Paul & KurtE,

First off a very embarrassing confession - I posted the wrong code, in my haste I had 2 sketches open and copied the wrong one! Please accept my sincere apologies for my incompetence and wasting your time. Lesson #1.

On the other hand, I did a bit more digging and found 2 SD-card related sketches that wouldn't compile because of the 'can't find kinetis.h' error, including the Teensy4.1SDsave example. I tried your advice of copy-to-text editor route without any change to the compile error. I then followed the next piece of advice and upgraded my IDE to 1.8.19 after which both sketches compiled. A valuable lesson #2 learned. Since this improvement I've tested the code and it gives the expected results.

I've also read the Teensy4.1SDsave code and I am starting to feel I understand it (although I couldn't have written it). The performance seems to be more than enough for what I want to do so think I will experiment further using it as the start point.

Whilst upgrading to IDE 1.8.19 I also loaded 2.0.1. However I couldn't get Teensyduino to load on top of it, but that might be because I had both IDE versions installed at the same time. I also note that Teensyduino states it works with IDE no higher than 1.8.19. What is the formal position on Teensyduino working with IDE 2.0.1? Should I uninstall 1.8.19 and re-try installing Teensyduino on 2.0.1?

I feel very bad about sending the wrong code but can only reiterate that I appreciate your efforts - it wasn't all wasted.

Kind regards
 
@PiltonBoy

TeensyDuino installer only works up to IDE 1.8.19

Install of boards for IDE 2 is different - but is supported:
When using IDE 2.0.1 the PJRC JSON string must be added to the "Ctrl+," list of board json's, posted in release note and another recent thread where I got:

Then open Left Edge 'Board Manager' and search for 'Teensy' and the Install option for Teensy Boards will show for 1.57.1 (?).
 
Back
Top