Search results

  1. S

    Teensy 4.1: can't get combined UDP/TCP server to work (now with example code)

    A few comments: 1. No need to use dynamic memory to create EthernetServer and EthernetUDP. Simply declare them like EthernetServer server{3260}; and EthernetUDP handle;. 2. For EthernetServer specifically, QNEthernet improves the Arduino-style API by adding the ability to set the port...
  2. S

    Linker error (embedding Lua on a Teensy 4.1)

    It’s possible to hook up a filesystem to your own definitions of _open(), _unlink(), etc. You’ll need your own filesystem, however. I use the “FS” filesystem interface that’s included with the Teensyduino core. You could plug in whatever implements that, for example, “LittleFS” or the SD card...
  3. S

    T4.1 Initializing Ethernet and CAN at the same time does not work.

    I’m curious, does initialization order matter? For example, if you initialize CAN first instead of Ethernet. Also, you need to account for millis() wraparound. Either compare with subtraction to a timeout value or use elapsedMillis instead. Last, is your logic for gSendDate correct?
  4. S

    Onboard LED

    Also note that this pin is the same as the default SPI clock pin, so if one runs SPI, the LED will flicker, indicating clock activity.
  5. S

    Onboard LED

    Also the LED_BUILTIN constant.
  6. S

    AsyncWebServer_Teensy41 mutex protection needed?

    You’re welcome. I cannot claim much PlatformIO work, however, other than some how-to posts about it and an EHEX PR in their repo. :) I did write the QNEthernet library, however.
  7. S

    AsyncWebServer_Teensy41 mutex protection needed?

    Here's how that server library is using the QNEthenet library: It uses the initialization code and the Ethernet ISR, but nothing else. It uses the lwIP API, otherwise, for its entire function (a slightly-modified copy is included with QNEthernet). Now, because the QNEthernet library is being...
  8. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    I just added an option to flush after all write calls. Other than the issue of write() not actually sending all the bytes (eg. because of internal buffers and such), just setting this new option in qnethernet_opts.h should duct tape the original issue (again, assuming the write() packets are...
  9. S

    Receiving Multiple DMX Universes?

    I’ve got one more thing for you to try: void loop() { bool doShow = false; read = dmxRx1.readPacket(packetBuf1, 0, 513); if (read >= 13) { for (i = 0; i < ledsPerStrip; i++) {leds.setPixel(i, packetBuf1[1], packetBuf1[2], packetBuf1[3]);} for (i = ledsPerStrip; i <...
  10. S

    Receiving Multiple DMX Universes?

    I’m stumped as to why the Teensy 4.1 is behaving differently than the Teensy 4.0. Are you using the exact same code on both of them?
  11. S

    Receiving Multiple DMX Universes?

    You must use at least "13" because you can't read index 12 (packetBuf[12]) without there being at least 13 valid bytes in the array. read >= 13 is correct, but read != -1 is not, and neither is comparing to "1" or "12" or anything less than "13". Instead of leds.show() at the end of loop(), try...
  12. S

    Need help with custom board that uses Teensy 4.1 (NativeEthernet) and separate W5500

    You’ve given me the idea to add multiple interfaces to the QNEthernet library. Right now, it supports either the native Ethernet or the W5500 (this driver is not yet committed, but it’s in a discussion comment in the repo on GitHub). No promises, but I’ll be exploring the topic. The QNEthernet...
  13. S

    Receiving Multiple DMX Universes?

    What happens if you replace both occurrences of if (read != -1) with if (read >= 13)?
  14. S

    Receiving Multiple DMX Universes?

    I’d love to help, but there isn’t any information other than the project “occasionally glitches.” The cause could be anything, and not necessarily the DMX library.
  15. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    Yeah, I expect it to be about the same speed. It’s just the proper way because write() may not send all the bytes requested of it. Since you’re using something like Modbus, I’m guessing that reliability is important to you. Yes, it looks similar to what writeFully() does under the covers. Check...
  16. S

    Receiving Multiple DMX Universes?

    I’m not sure what “glitch” means here. Also, there’s no code, so I don’t know what’s happening. It could be your code and not the library. There’s a gazillion factors.
  17. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    You’re right about writeFully(). I didn’t look at that Modbus library closely. They’re using “Client” and not “EthernetClient”. Ignore the writeFully() note for now. (But write() calls should still technically be called repeatedly until they’re done with the input. See that README link I posted...
  18. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    I just realized that all the bytes still may not get out. Any write() calls (with any library, really) should have their return values checked and then any unsent bytes should be re-sent. write() doesn't always send all the bytes it's given. A better QNEthernet equivalent would be: size_t retval...
  19. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    I’ll add: it’s not correct to always assume some write() call (on, say, the Arduino Print interface, which many types of objects implement) completes without buffering. Unfortunately, many programs and libraries assume this. See...
  20. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    A couple of things I noticed at first glance: 1. There's no need to specify a MAC address on the Teensy 4.1 because there's a built-in one. May I suggest using the begin(ip, netmask, gateway) function instead? As well, the one you're actually using in the code you pasted is begin(mac, ip, dns)...
  21. S

    Inherent Latency in Ethernet Modbus over Serial with Teensy 4.1?

    If you can share a complete, minimal, example that shows the issue, maybe I could have a look. Also describe how to test it.
  22. S

    Serial.printf in a thread causes thread to hang

    In my experience, I haven’t needed a threading library to do cooperative threading. It’s possible to design a simple API where each “Task” returns from its own main loop when it’s done or needing to yield. Doing a yield() via a threading library is effectively the same thing, except you do have...
  23. S

    PlatformIO: Creating a list file after Building automatically.

    For convenience, here's the contents of that file: Import("env") print("Current CLI targets", COMMAND_LINE_TARGETS) print("Current Build targets", BUILD_TARGETS) def post_program_action(source, target, env): print("Program has been built!") program_path = target[0].get_abspath()...
  24. S

    Teensyduino 1.59 Beta #6

    @Paul Yes, it seems to work. What was the fix?
  25. S

    Teensyduino 1.59 Beta #6

    @Paul I’ll try this soon, when I’m next at my laptop; just want to acknowledge I see the link.
  26. S

    Teensyduino 1.59 Beta #6

    Intel. MacBook Pro bought in 2020.
  27. S

    Unable to find Teensy Loader in Arduino IDE 1.8.19 (Teensyduino version) on a Mac

    See this thread instead: https://forum.pjrc.com/index.php?threads/teensyduino-1-59-beta-6.74402/post-338551
  28. S

    Teensyduino 1.59 Beta #6

    Summary point, repeated at the bottom: Something changed between 1.57 and 1.58 that prevents me from running the built-in Teensy Loader app from the 1.8.19 Teensyduino IDE install in all versions from 1.58 and onwards. I can no longer seem to start Teensy Loader after a fresh install of the...
  29. S

    Teensy 4.0 DMX Lighting Control

    It was the board transition to Teensy 4 that probably tripped you up here. Teensy 3’s have their pins 7 & 8(TX) connected to Serial3. Ref: https://www.pjrc.com/teensy/pinout.html
  30. S

    Teensy 4.0 DMX Lighting Control

    Pins 7 & 8(TX) are Serial2. Pins 15 & 14(TX) are Serial3. Ref: https://www.pjrc.com/store/teensy40.html You could either change pins or change Serial3 to Serial2 in the example source.
  31. S

    Teensy 4.0 DMX Lighting Control

    Ah, yes. I have a feeling there’s a few copies of the library files in various places. Perhaps even one inside the example folder or something. I’d have to look more closely at where all your files are to be sure. I’m glad you got it working compiling.
  32. S

    Teensy 4.0 DMX Lighting Control

    It doesn’t look like you have the library installed or installed correctly. First, install TeensyDMX via the Arduino Library Manager. (It looks like you’ve done this.) Next, download the ZIP file and overwrite the contents of wherever TeensyDMX is installed for your platform. Perhaps you have...
  33. S

    Teensy 4.0 DMX Lighting Control

    I see what happened. It’s because I haven’t created a latest release, and that’s where the changes are. Check out the latest on GitHub. If you don’t usually use git, it’s easy to click on “Download ZIP” from the main project page (it might be under the “Code” button). You can unzip that over...
  34. S

    Teensy 4.0 DMX Lighting Control

    Fun fact: The USB Serial port on Teensy actually isn’t affected by the baud rate settings. The speed is whatever speed the USB connection can do. A little while back, I wrote a library called TeensyDMX, and in that library, there’s a fairly full-featured example called USBProWidget. It converts...
  35. S

    Unable to find Teensy Loader in Arduino IDE 1.8.19 (Teensyduino version) on a Mac

    I'm on a Mac (Sonoma) and I've been using the latest Arduino IDE 2.2.1 lately, but had a need to use the lockable Teensy features of the 1.8.19 version. (Both latest version from https://www.pjrc.com/teensy/td_download.html (1.58) and from...
  36. S

    Teensyduino 1.59 Beta #5

    I think the warning is intended for code that may be used to interact with other code or libraries in the future, or if it is intended to itself become a precompiled library. Since most Arduino (or Teensy) projects are standalone, and since all the sources are compiled from scratch (with the...
  37. S

    Looking for a good starting point on teensy 4

    Are you interested more in the library creator side or using libraries in a more advanced way?
  38. S

    QNEthernet connect() grief

    It would be amazing (and appreciated) if you could do a little sleuthing for why NativeEthernet seems to behave differently with netcat than QNEthernet does. (Eg. with Wireshark, as you suggest.) That closeOutput() call does a TCP “half close”. I use it sometimes, with the suggestion of one of...
  39. S

    QNEthernet connect() grief

    Hi, quiver. Thanks for using QNEthernet. Source is here: https://github.com/ssilverman/QNEthernet/blob/master/src/QNEthernetClient.cpp Side note: connect() returns an int, not an int8_t. -1 is timeout and 0 means "some other failure", such as a NULL IP address or there was some other problem...
  40. S

    Combining two 32-bit values into one 64-bit value: unexpected result

    Until C++20, left-shifting a negative signed value is undefined, alas. That’s one of the reasons first casting to an unsigned is important (as @Nominal Animal points out). (Right-shifting a negative value is implementation-defined.) Ref...
  41. S

    New lwIP-based Ethernet library for Teensy 4.1

    Here's some updates: I made a driver for the W5500 that plugs into QNEthernet. You can enable it in the new qnethernet_opts.h file (after overwriting using the ZIP file about to be mentioned). I haven't put it in the latest `master`, but you can find it here...
  42. S

    TeensyThreads: using ThreadWrap shows error in Visual Studio

    Do you have a small code example that could be tried so the problem can be observed?
  43. S

    Failed to configure Ethernet using DHCP

    I’m glad you got it working! Here’s a post I made with a bit of history: Post in thread 'compiler error' https://forum.pjrc.com/index.php?threads/compiler-error.73841/post-333932 The “Ethernet” library is designed to be used with the WIZnet chips over SPI.
  44. S

    GCC 11

    Is that variable being modified, say, from an interrupt or something? I’m throwing darts here because we don’t know what the code looks like, but what happens if you also make the variable volatile?
  45. S

    Teensy 4.1 and Ethernet, a workshop experiment

    I have some time today if anyone wants to join again. I can help with the things I know and can possibly answer any vexing coding questions. Send me a direct message on this forum if you’d like to join. Why am I doing this? Because it’s enjoyable, I get to learn stuff better through the act of...
  46. S

    Advice on program construction - DMX

    See the fill() function. From the source: // Fills all channels in the specified range to the given value. // The behaviour is atomic. // // This returns `false` if any part of the channel range is not in the range // 0-512, or if the length is negative. Otherwise, this returns...
  47. S

    Teensy 4.1 sACN E1.31

    I’ll add: with the QNEthernet library (instead of NativeEthernet), you can also simply add an Ethernet.joinGroup(multicast-ip) call to wherever you’re initializing Ethernet, and that allows you to keep the regular UDP begin(port) call. Joining a group in QNEthernet is separate from listening on...
  48. S

    Teensy 4.1 sACN E1.31

    You need to join the multicast group instead. Change wherever the UDP socket calls begin(port) to beginMulticast(multicast-ip, port). (This is for the NativeEthernet library, which the example uses.)
  49. S

    Advice on program construction - DMX

    DMX only updates at about 44Hz (22.7ms duration) (for 513-byte packets; it’s faster if the packet contains fewer slots). (For those that don’t know this fact already.) You could try reducing the packet size for a much faster DMX update rate. (Assuming the equipment works with that.)
  50. S

    Advice on program construction - DMX

    I think the Teensy can handle this. The DMX runs asynchronously, and the DMX is constantly being output (it’s a continuously-transmitting protocol). In fact, it can transmit on all 8 serial ports at the same time. So really, the limiting factor is the speed at which you can process whatever your...
Back
Top