Search results

  1. T

    Which of the two "hidraw" devices is my RawHID?

    You can use usage page / usage: cat /sys/class/hidraw/hidraw0/device/report_descriptor | hidrd-convert -o spec Usage Page (FFC9h), ; FFC9h, vendor-defined Usage (04h), Collection (92), Report Size (8), Logical Minimum (0), Logical Maximum (255), Report Count (64)...
  2. T

    What's the resolution of micros() on Teensy 3.1 ?

    micros(), which is called by elapsedMicros, re-enables interrupts. So the timer interrupts still happen. uint32_t micros(void) { uint32_t count, current, istatus; __disable_irq(); current = SYST_CVR; count = systick_millis_count; istatus = SCB_ICSR; // bit 26 indicates if systick...
  3. T

    Full byte/word read and writes? 3.2

    In terms of useful consecutive pins, you have C0 - C7, B16 - B23 and D0 - D7. The port registers are 32 pins / bits, but byte access works. So you could do 3 byte writes for the pins I mentioned to set 16 address bits + 8 data bits. E.g to set B16 - B23: volatile uint8_t* ptb_16_23 = (volatile...
  4. T

    help with atoi code

    You have buffer overflows everywhere. All your toCharArray() stuff is wrong and uses buffers that are too small. There is no reason to use atoi. Use String::toInt() (it uses atol() under the hood): int tmin = readString.substring(posmin + 4).toInt(); If you want to limit the length of the...
  5. T

    USB Host Mouse Driver

    I don't think you are supposed to use the interface subclass to identify the device type. Per USB HID spec (Device Class Definition for Human Interface Devices (HID) Version 1.11): 4.2 Subclass ... The HID committee agreed on the improbability that subclass protocols for all possible (and yet...
  6. T

    USB Host Mouse Driver

    I tried a Microsoft Optical Mouse Blue and a Logitech G400s, both work correctly (with the Mouse-Rabbit-Hole branch).
  7. T

    Teensyduino 1.39 Beta #1

    Are you running some real-time virus scanner? The file might be opened by the scanner and thus ar.exe fails.
  8. T

    CAN 2.0B Transceiver Suggestions

    Doesn't work for me. Messages with extended IDs are not received without setting up the filters (Teensy 3.6). Can you post a working example that uses 2 Teensies (or the 2 CAN interfaces on 3.6)?
  9. T

    SdFs - a New SD Library for FAT16/FAT32/exFAT

    My best SD card can do about 5MB/s sustained on Teensy 3.6 (220kB buffers) with a contiguous, pre-allocated, pre-erased file. It sounds like Bill's Samsung card might do 18MB/s with the same code. At least with the cards I tested, pre-erasing is important (or there are more house-keeping...
  10. T

    Raspberry Pi Hardware

    I would be hesitant to use some non-Raspbian distro. Standard Debian armhf is ARMv7 with hard float, armel is ARMv4 with soft float. Raspbian is ARMv6 with hard float (Pi 1 is ARMv6). I would also be hesitant to use cross-compilation. If you are very lucky and all your libraries are regularly...
  11. T

    Teensyduino 1.38 Released

    Blink build failure It looks like this commit is responsible: https://github.com/PaulStoffregen/cores/commit/632f311db1b60a5b6a89f2d9c1dee782e2747e71 Since Teensy LC has a shared interrupt for the PIT channels, it should probably be wrapped in a '#ifdef KINETISK'.
  12. T

    SdFs - a New SD Library for FAT16/FAT32/exFAT

    Is that a Kinetis / Teensy issue or a general issue with the native SD mode (does it work on some other hardware)?
  13. T

    CAN 2.0B Transceiver Suggestions

    The transceiver doesn't matter, it's only responsible for the electrical interface. To receive messages with extended IDs, set up filters like this: https://github.com/collin80/FlexCAN_Library/blob/master/examples/ObjectOrientedCANExtendedIDs/ObjectOrientedCANExtendedIDs.ino#L73
  14. T

    Memory leak in RawHID (hid_WINDOWS.c)

    That has been reported before: https://forum.pjrc.com/threads/36745-Memory-leak-in-Windows-rawhid-sample-code
  15. T

    display white balance / color correction

    If that doesn't work well enough, it's probably easiest to just play a bit with different gamma values for the different colors and not bother with more measurements.
  16. T

    display white balance / color correction

    You would run ArgyllCMS spotread on your PC and display some fixed color on the ILI (via some sketch) and make manual measurements. Something like 5 - 10 per color is probably more than enough with some decent interpolation. That will work, if the spectrum of backlight / LCD color filters is...
  17. T

    display white balance / color correction

    You can try, but it will be quite inaccurate. A different light source will result in different results, as will a different camera sensor. If you are lucky and it's well-behaved yes. However, there are quite mis-behaved LCDs, where you might have a gamma of 1.5 for one color channel and 2.4...
  18. T

    Teensy 3.1 and CAN Bus

    At 1Mbps, you can have around 12000 messages per second maximum (small packets). Teensy 3.2 has no problems whatsoever handling that. What does that mean? Are you looking at the refresh rate of a slow I2C display? If so, try without the display and dump the messages to USB serial.
  19. T

    Teensy 3.6, after Reset SD Card does not always initialize.

    Good catch. Does SdFat-beta have the same issue?
  20. T

    noInterrupts() allowing some interrupts - LIS3DH, NRF24L01+, Teensy 3.6

    Disabling interrupts for a long time is a broken design. Various stuff won't work correctly, if interrupts are disabled. Many functions will enable interrupts, when they were disabled: https://forum.pjrc.com/threads/43795-noInterrupts()-not-working...
  21. T

    Another fork of FlexCAN

    That doesn't work. For a transceiver-less setup, you can do the following: https://forum.pjrc.com/threads/43684-CAN-bus-Teensy-Teensy-communication-without-transceiver
  22. T

    Teensy 3.1 and CAN Bus

    The current FlexCAN library is incompatible with earlier versions, so your code won't work: https://forum.pjrc.com/threads/45344-Tennsy-3-2-doesn-t-read-CAN-messages
  23. T

    A dangerous Teensy 3.6 quirk

    The Newlib 'free()' does coalesce memory blocks. Assuming the static allocations don't exceed the size of the lower SRAM area, the following hack could be used to block out the memory at the boundary: // Return true if memory at SRAM boundary was successfully reserved. // One tiny memory block...
  24. T

    Need some help passing arrays

    You are creating 2D arrays, probably not what you wanted. You are passing an array row to DumpText, the second element of which is a nullptr. What you probably want is: const char* InvertText[2] = {"Black", "White"}; const char* OrientationText[2] = {"Up", "Down"}; const char* VoltInputText[2]...
  25. T

    A dangerous Teensy 3.6 quirk

    This is bound to fail, depending on the compiler options. GCC recognizes this code as memcpy loop and may even call memcpy when it can track aliasing between src and dst. \\ There is the "-mno-unaligned-access" option for GCC, which will disable unaligned access. However, the non-inlined...
  26. T

    IntervalTimer::UpdateInterval(void (*funct)(), uint32_t cycles) addition?

    Not calling 'end()' doesn't buy you much. Calling 'begin()' still aborts the current timer cycle and restarts the timer. To update the interval for the next cycle (avoiding the restart), you can do it like this: void updateInterval(IntervalTimer& timer, float period) { size_t channel_nr =...
  27. T

    analogWriteFrequency and analogWrite rounding

    The pins are grouped in 5 ports, port A - port E. Each port can trigger DMA transfers. The schematic has the pin / port mapping; e.g. pin 22 is PTC1 (pin 1 of port C). volatile uint32_t *pin_config = portConfigRegister(pin_nr); *pin_config |= PORT_PCR_IRQC(0b0010); // DMA on falling...
  28. T

    A dangerous Teensy 3.6 quirk

    That's not required. With the default Teensyduino compiler settings, unaligned access is considered supported and used by GCC: void __attribute__((noinline)) testMemcpy(char* ptr) { uint16_t v = 0x4142; memcpy(ptr, &v, 2); } No alignment check is performed and an unconditional 16-bit...
  29. T

    Real low latency logging for Teensy 3.5/3.6 SDIO SD

    Using dynamic sizes will be messy. Structs normally have a fixed size. In C99, there is something called Flexible Array Member, which is supported as non-standard extension by GCC in C++ mode. However, there are a lot of restrictions in terms of usage (you can't really use them in an array)...
  30. T

    A dangerous Teensy 3.6 quirk

    16 / 32-bit writes to 0x1FFFFFFF do result in a hard fault (reads don't). Teensy 3.0, 3.1, 3.2 have the same issue: https://forum.pjrc.com/threads/25256-Teensy-3-hard-fault-due-to-SRAM_L-and-SRAM_U-boundary
  31. T

    analogWriteFrequency and analogWrite rounding

    Your 'analogWrite()' updates 'FTM0_C0V'. This register is double-buffered and synchronized at the end of the PWM cycle / timer counter overflow. The initial 'FTM0_C0V' value is zero, so you miss the first PWM cycle. 'analogWrite(22, 0)' doesn't change 'FTM0_C0V'. It changes the pin mode...
  32. T

    Real low latency logging for Teensy 3.5/3.6 SDIO SD

    When the log file is full, logging is stopped and 'loop()' blinks the LED. Note the return from 'setup()': https://github.com/tni/teensy-samples/blob/master/SdFatSDIO_low_latency_logger.ino#L335 ... if(!file.write(log_buffer->rawData(), log_buffer->rawSize())) {...
  33. T

    Arduino Events

    @KurtE: GCC >= 5 can check for include files: #if defined(__has_include) && __has_include(<EventResponder.h>) #warning "Have EventResponder.h." #else #warning "Don't have EventResponder.h." #endif The pre-processor performs short-circuit evaluation, so the above check works for old TD...
  34. T

    ISR latency Teensy 3.1 and 3.6

    Yes, but the timer can do this for each channel. CH0 captures the first edge; CH1 captures the second edge. You can read both captured values in the CH1 interrupt and compute the delta.
  35. T

    Best communication interface for multiple Teensy LCs and 3.Xs

    IMO, it's the other way around. Half-duplex multi-node RS-485 is a lot more cumbersome than CAN, particularly once you incorporate robust error handling. The basic CAN communication is very simple, only some of the higher level protocols that have been built on top of CAN are complex.
  36. T

    Best communication interface for multiple Teensy LCs and 3.Xs

    If your communication pattern fits well into the base CAN format of having packets with message ID + up to 8-byte payload, I would go with CAN. Any device on the bus can initiate communication and you get hardware error checking and automatic re-transmission for free. If you have a small...
  37. T

    ISR latency Teensy 3.1 and 3.6

    Why do you care about latency? The FTM timers can capture the timestamp, if you only want to measure the time between CH0 / CH1 edge. Interrupts have a fair amount of latency, but if you are seeing 2us, you have inefficient code. You could transfer the captured timer values into a ring-buffer...
  38. T

    Teensyduino 1.38 Beta #2

    The SD socket pins are there: https://github.com/PaulStoffregen/cores/commit/db1e687b18dfcdd0373d666d70ba0dbd668a2f26 Port E0 - E5 is mapped to 58 - 63 (core_pins.h): #define CORE_PIN58_BIT 0 #define CORE_PIN59_BIT 1 #define CORE_PIN60_BIT 2 #define CORE_PIN61_BIT 3 #define CORE_PIN62_BIT...
  39. T

    Sdio

    No, it's not. In fact, it's quite a bit slower for small blocks, e.g.: https://forum.pjrc.com/threads/40150-CAN-logger-and-SD-card-speed While the benchmark works for me, I've had issues with SdFatSdio working reliably. There is little reason to use SdFatSdio. The SdFatSdioEX data transfer to...
  40. T

    analogWriteFrequency and analogWrite rounding

    You can abuse the DMA controller to get a 15-bit counter (you can poll it and use the delta to get an extended counter). The DMA trigger occurs on the falling PWM edge. If you want it at the rising edge, you could use a second timer channel, e.g. FTM0 channel 1 and set FTM0_C1V to 0 for the DMA...
  41. T

    analogWriteFrequency and analogWrite rounding

    For FTM in TPM mode, the MOD register write is buffered and the synchronization / update happens when the counter overflows (assuming you leave the timer running). E.g. K20 manual, '35.4.10.2 MOD register update' or AN5261, '4.2. MOD register update (FTMEN = 0)'. However, you would probably...
  42. T

    FreqMeasureMulti nanosecond issue

    float FreqMeasureMulti::countToNanoseconds(uint32_t count) { #if defined(__arm__) && defined(TEENSYDUINO) && defined(KINETISK) return (float)(count * 1000) / (float)(F_BUS / 1000000); #elif defined(__arm__) && defined(TEENSYDUINO) && defined(KINETISL) return (float)(count * 1000) /...
  43. T

    Shutdown RTC current

    I have measured 2.54uA for Teensy 3.6 and 2.33uA for Teensy 3.5. Yes, that seems quite a bit more than the datasheet says. They may have used a crystal with less power consumption, but I still wouldn't expect that big a difference...
  44. T

    analogWriteFrequency and analogWrite rounding

    analogWriteFrequency() aborts the current PWM cycle. It disables and restarts the timer, so you get a PWM glitch. The hardware has synchronization for the timer control registers. You can get glitch-free PWM output by programming the timer directly. However, that register synchronization...
  45. T

    Teensyduino 1.38 Beta #2

    Chances are 99% that it's a valid warning and the code in question buggy (wherever it may be from).
  46. T

    Jitter-free DAC output using the FIFO and DMA

    Yes, it's going to work fine. Look at this: https://forum.pjrc.com/threads/45214-Fast-streaming-USB-data-through-Teensy-DAC?p=147943&viewfull=1#post147943
  47. T

    I2c/SPI flash/uSD/interrupt sampling design question

    A typical datasheet value is 200mA max averaged over 1s for high speed operation (50MHz), peak current is rarely specified. While the card is not actively writing, but has open commands (e.g. open-ended SdFat writes), power consumption for my cards is 15mA - 35mA (depending on the card). If...
  48. T

    I2c/SPI flash/uSD/interrupt sampling design question

    You are WAY off base. All my MicroSD cards have worst-case latencies >800ms with standard file writes. That decreases to 30-45ms worst case latency with pre-allocated, pre-erased files. Writing inside 'loop()' is the way to go and doesn't interfere with interrupts. SdFat has no problem with...
  49. T

    SD Card higher Snooze.hibernate currents.

    That means there is an open command and the card doesn't go to sleep. E.g., SdFatSdioEX uses open-ended transfers. Calling 'sd.card()->syncBlocks();' will allow the SD card to go to sleep.
  50. T

    Power off Teensy 3.6 SD card?

    Get a better SD card. E.g., I have a Transcend 16GB card that uses 85uA sleep current. You have to make sure the card is initialized before hibernating, otherwise it will draw a lot more power. If you want to switch off SD power, you need to keep in mind that some cards have a huge amount of...
Back
Top