Search results

  1. S

    Teensy 4.1 Dual‑USB Serial: How Are COM Ports Assigned?

    Appreciate everyone for taking the time to share information. Looks like the easiest way would be to send some data over each port whenever it USBSerialx.dtr() is changed. I was hoping not to do it, because then I either have to poll it or change some core code if polling is to be avoided.
  2. S

    Teensy 4.1 Dual‑USB Serial: How Are COM Ports Assigned?

    Hi all, I’m building a project around a Teensy 4.1 using its built‑in dual USB‑Serial (CDC) interfaces. On Windows (and other OSes), I see two COM ports pop up whenever I plug in the board—but the numbers (e.g. COM3/COM4, COM5/COM6, etc.) don’t always stay the same: Sometimes the “first”...
  3. S

    Wii-Nunchuck with teensy 4.1

    Just found out from this video - the adapter PCB that I was using is wired wrong. So that can happen.
  4. S

    Wii-Nunchuck with teensy 4.1

    Hi all, I’m trying to hook a Wii Nunchuck up to a Teensy 4.1 over I2C. Using the built-in I2C scanner sketch from the Teensy Arduino examples, I can successfully detect an MPU-6050 and an OLED display. So I am pretty sure about that basic I2c works with my setup. But when I plug in the...
  5. S

    external PSRAM usage advice on the Teensy 4.1

    I've just installed two 8MB PSRAM chips from the Teensy store and ran the test sketch — everything appears to be working fine. I don’t come from a programming background, but in my current project, I have a time-sensitive Timer ISR running at 1 kHz. It reads about 256 bytes from a float array...
  6. S

    Teensy USBHost with a USB WiFi dongle

    So one my friend is working on drone light show project. He is using a pixhawk flight controller, which uses a mavlink protocol to communicate with a drone. Now to communicate with multiple drones, he has a rpi zero 2w as a packet router from the Flight controller to a network, a wifi router...
  7. S

    What's the standard way to do atomic assignments on teensy 4.1

    Context: I have a timer interrupt running at 1 kHz that performs calculations. For these calculations, I need 6 float values, which are received over USB serial. The serialEvent() function (called at over 7 MHz) assigns values to these 6 floats. Given that the Teensy 4.1 is a 32-bit...
  8. S

    Interrupt safe read.

    Thanks @joepasquariello and @jmarsh . If anyone could point to a document, that would definitely help me sleep better.
  9. S

    Interrupt safe read.

    I'm using a Teensy 4.1, and I have a float variable (tgtfr) that's updated in serialEvent() based on serial input. This same variable is read inside a timer interrupt that fires every 1 ms. The main loop is running very fast — over 7 MHz, based on measurements (just incrementing a counter per...
  10. S

    Teensy 4.1 USB Host cable

    wdym? you are breaking my brain, I have using a 4 pin connector for ages
  11. S

    How to use USBHost_t36 library.

    Just found out that setting a flag in the timer and based on the flag, using uSerialN.flush() my problem., but I am still confused about the role of myusb.Task() function.
  12. S

    How to use USBHost_t36 library.

    While testing another script, I accidentally commented out myusb.Task() in loop() and instead added delayMicroseconds(40). Surprisingly, the Master could read data from the Slave at up to 2.5 kHz. This makes me wonder: How to use properly use myusb.Task()? and Does frequent polling of...
  13. S

    How to use USBHost_t36 library.

    I've been working with the USBHost_t36 library on a Teensy and have written two sketches to test high-frequency USB serial communication. The Master sends timestamped data packets to three USBSerial_BigBuffer ports at a fixed interval. The Slave, connected through a USB hub, simply echoes back...
  14. S

    Detecting USB Serial Connection State on Teensy 4.1

    No, I was looking for if the serial port was opened by an application on the PC
  15. S

    teensy 4.1 coding guidance for USB serial communication

    Thanks for sharing, will keep it in mind
  16. S

    Detecting USB Serial Connection State on Teensy 4.1

    Like I get the following output #include <Arduino.h> volatile bool isConnected = false; void my_usb_callback() { isConnected = Serial.dtr(); digitalWrite(13, isConnected); Serial1.printf("%s\n", isConnected ? "C" : "D"); Serial1.println(!bitRead(USB1_PORTSC1,7)); } elapsedMillis timer...
  17. S

    Detecting USB Serial Connection State on Teensy 4.1

    I am monitoring the value of !bitRead(USB1_PORTSC1,7) with a hardware serial port. for some reason, it's always 1 for me
  18. S

    Detecting USB Serial Connection State on Teensy 4.1

    with different applications, the callback counter is incremented by different amount. EDIT: Sorted some of the issues
  19. S

    Detecting USB Serial Connection State on Teensy 4.1

    I have a working solution, but I'm unsure about the potential implications of these modifications.If anyone with more experience could take a look, I’d really appreciate it. I modified the Teensy 4.1 core files to call a callback function whenever the USB serial connection opens or closes...
  20. S

    Detecting USB Serial Connection State on Teensy 4.1

    Hey everyone, I have a Teensy 4.1 controlling two motors, and I need a way to disarm them if the USB serial connection is lost. Right now, in my control loop, which runs every 1ms, I check Serial.dtr() before sending any commands to the motors. However, I was wondering if there’s a way to...
  21. S

    Which CAN library to use for Teensy 4.1

    FlexCAN_T4.h without any question, very efficient and just works
  22. S

    Teensy 4.1 CAN Bus Problems

    not too long ago, I used the following script to time the canbus transmission, you may find it useful, by printing the message in the msg.buf field For my test, I connected one of the can module to CAN1, and the other to CAN2. If you see that the sent and recieved messages are same, then you...
  23. S

    teensy 4.1 coding guidance for USB serial communication

    At this point I am quite content on how the USB Serial Transfers data, I had a new question, is there any way to trigger an interrupt based on USBSerial connection state? currently my code polls Serial.dtr(), was wondering if there is a cleaner way in teensy 4.1
  24. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    #include <USBHost_t36.h> byte packetBuffer[240009]; USBHost myusb; USBHub hub1(myusb); USBSerial_BigBuffer slaveSerial1(myusb, 1); USBSerial_BigBuffer slaveSerial2(myusb, 2); // USBSerial_BigBuffer slaveSerial3(myusb, 3); // Global buffers for accumulating partial lines String buffer1 = ""...
  25. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    I have ran the examples, will share a verison of the serial router soon, differnce will be, instead of hadware serial, will use the USBHost_t36 to route packets, Ethernet was another attractive options, for my use case at least, but I bought 12 teensy 4.1 without the chip unfortunately.
  26. S

    teensy 4.1 coding guidance for USB serial communication

    For USB Serial, I was transferring large chunks, later I found, If your buffer is entirely full, send_now works pretty well, it depends , how you stage the transfer. I loved SerialTransfer, but one limitation for me was the max buffer size, I might rewrite the lib or something similar bare...
  27. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    Agreed, already ordered the RAM chips. By design, the system runs at constant rate. and the impacts are continuous as well, they contain high frequency content, but repeat at 3 Hz. For the reason mentioned, CAN is not an option in my opinion as well. This seems like the only viable solution...
  28. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    Hi @AndyA, thanks for taking the time to read my question. The need for 1 kHz control is actually beyond my control. If it were up to me, I would have stuck with something like 50 Hz. The reason for 1 kHz control is that the trajectory my robot (a Stewart platform) needs to follow involves...
  29. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    I just realized can't use Ethernet, because teensy 4.1 I have doesn't have chip soldered (NE version I believe). Can I use my master teensy as USB host as a drop in replacement in that case? just to give a picture, this is what my working master teensy code looks like - #define CHUNK_SIZE 128...
  30. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    Will look into it, thanks for the suggestion sire.
  31. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    I am using very short wires(<15 cm), with a teensy breakout boards and screw connectors for holding wires in place, intend to use rs 422 in the future, once everything is final. Considering SerialTransfer , I might mod it a little to use crc32 for very large packets I intend to send. My...
  32. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    | Fair point, A bit of background for anyone coming across this post: I have a robot with six motor controllers, and the entire control system is developed and tuned to operate at a sampling frequency of 1 kHz. Due to the setup, I am using one Teensy per two axes, along with a master Teensy...
  33. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    Dang, here I was thinking, I am gonna use a teensy as a serial router. Thanks for the feedback guys
  34. S

    Teensy 4.1 UART Communication: How to use Hardware Serial?

    EDIT : There was a bug in my previous code, I found just after posting. Editing the question since I have a new question. Hey everyone, I'm working on a project involving two Teensy 4.1 boards, where I need to send structured binary data to the master over usb serial, then from the master to...
  35. S

    Teensy 4.1 hardware accelerated CRC32.

    Without DMA, It wroked upto 700x6 shaped float array, for me that's 0.7 seconds of axis control data. I will try soon with different vars. I will also take a closer look at how crc/mpeg2 works, maybe that will give me some insight, so far I just have been throwing things to see what sticks.
  36. S

    Teensy 4.1 hardware accelerated CRC32.

    thanks @joepasquariello , for me it worked for 5x5 float arrays, didn't work for anything larger for some reason, the codes are shared below if anyone is interested. Python code for checking ground truth - import numpy as np import crcmod # Create CRC-32/MPEG-2 function using crcmod...
  37. S

    Teensy 4.1 hardware accelerated CRC32.

    Is there any library, with hardware acceleration? for teensy 4.1 I have been using FastCRC , from the src code I think it has hw acceleration for teensy 3.0 / 3.1 / 3.2 / 3.5 / 3.6. Is there something similar for teensy 4.1? I was hoping to get sub 2ms calculation, which would make other parts...
  38. S

    Different CRC when using Platformio and Arduino IDE

    I looked into the folder where all the platformio libraries are located for teensy boards, and replaced it with the one from github, things are working now, thanks for the insight @shawn. Now this is working for all my projects.
  39. S

    Different CRC when using Platformio and Arduino IDE

    I think you are right, If I paste the FASTCRC library, downloading directly from github, to the lib folder in the platformio project, it works fine and the function parameters seems to match -
  40. S

    Different CRC when using Platformio and Arduino IDE

    If I hover my mouse cursor over the crc32 method from vscode, and arduino ide, I see two different things
  41. S

    Different CRC when using Platformio and Arduino IDE

    @shawn ; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the...
  42. S

    Different CRC when using Platformio and Arduino IDE

    I found a temporary solution, I downloaded the FASTCRC library and put it it the lib folder of my PIO project, seems to be working now.
  43. S

    Different CRC when using Platformio and Arduino IDE

    @jmarsh and @joepasquariello , the root of all my problem is in the pio platform size_t is a uint16_t type var, any idea how can i change that. In arduino ide it gets interpreted as a uinjt32_t I tried with a smaller array, array size of 2730 elements, it works with pio then, which is for me...
  44. S

    Different CRC when using Platformio and Arduino IDE

    I am using a teensy 4.1 I am trying to calculate CRC32 of a large float array, when I upload the code using arduino IDE, the result matches with the CRC32 calculated in python how ever, when I upload the same code using platformio, the CRC is different. """ python : CRC32 of float array...
  45. S

    teensy 4.1 coding guidance for USB serial communication

    I’m using a Teensy 4.1 and need to transfer large amounts of data in a duplex manner. I have a few questions: 1. Performance of Serial.send_now() I noticed that using Serial.send_now() reduces my data transfer speed. Specifically: Without send_now(): 20.97 MB/s With send_now(): 10.26 MB/s...
  46. S

    Efficient wait until event.

    @MarkT , could you please specify which event handling are you talking about? inside the source code for delay.c i found delay calls yield at 1 KHz, which in turn calls the serialEvent. So even If put delay(infinity), serialEvent is called at 1 KHz, and interrupt callbacks takes priority...
  47. S

    Efficient wait until event.

    Thanks @jmarsh follow up question - Is this a good idea? #include <IntervalTimer.h> String inputString = ""; IntervalTimer myTimer; // void yield() // { // // } void timerISR() { yield(); } void setup() { myTimer.priority(255); myTimer.begin(timerISR, 1000); pinMode(LED_BUILTIN...
  48. S

    How do I determine if my interrupt callback function execution time is acceptable?

    Thanks every one for contribution, I guess I will try all the suggestions mentioned here and see whats happening. Thanks , much appreciated.
  49. S

    Efficient wait until event.

    I’m implementing a real-time control system on a Teensy 4.1 and wanted to keep the loop() function completely empty, handling all computation inside interrupts. To achieve this, I tried the following approach: const uint32_t maxUnsignedLong = ~0UL; // Maximum value of uint32_t void setup() { }...
  50. S

    FlexCAN_T4 Receive timing.

    thanks everyone, I measured the times with a scope and you @CollinK and @AndyA you were right, considering bit stuffing the timing is actually spot on, I tried with a multiple baudrates. Thanks to @AndyA for showing me how to use the ext_output1 function. My main concern was If I had wrote the...
Back
Top