Call to arms | Teensy + WiFi = true

Ok, I found our schematic:
image (1).png

Also, here is a link to my GitHub repo containing most of the information we all collected. It may be of use to you...
EDIT: It looks like we are using the HOST_WAKE pin for int. 1DX pin #27.
 
Thanks, so far I am not seeing it...
Will look again later
Good luck. You probably have tons of boxes, drawers and closet to look through like I do ;) Took me a half hour to locate Paul's T4.0 breakout board yesterday...
 
Good luck. You probably have tons of boxes, drawers and closet to look through like I do ;) Took me a half hour to locate Paul's T4.0 breakout board yesterday...
yep,

1781123103523.png


Found it the last place I looked 😉

Looks almost similiar:
Although the Nicla Vision has: SS4325012 part and this one has: SS2211007
 
Ok all a couple of things.

Has anybody tried UDP an gotten it to work?

Also I playing around and it keeps hanging at

Rich (BB code):
Starting...
Starting Ethernet with DHCP...
===========================
CYW4343W Card::begin: SDIO2
===========================
Attaching OOB interrupt to pin 34
Enabled CYW4343W bus high speed interface
BUS_IORDY_REG (Ready indication) returned OK
SDHC bus set to 4-bit, speed set to 33MHz
*************
CardID: 43430
*************
Set SRAM_IOCTRL_REG validated
Set SRAM_IOCTRL_REG second validation
Set SRAM_RESETCTRL_REG validated
Uploading firmware data
Uploaded firmware, 419798 of 419798 bytes
Uploading NVRAM data
Uploaded NVRAM, 680 of 680 bytes
Set BAK_CHIP_CLOCK_CSR_REG issue, response: 0x50
driver_get_system_mac

THis is the test sketch I am using:

C++:
// SPDX-FileCopyrightText: (c) 2021-2026 Shawn Silverman <shawn@pobox.com>
// SPDX-License-Identifier: AGPL-3.0-or-later

// SNTPClient demonstrates a simple SNTP client.
// See: https://tools.ietf.org/html/rfc4330
//
// This file is part of the QNEthernet library.

// C includes
#include <sys/time.h>
// Assume settimeofday() exists

// C++ includes
#include <cerrno>
#include <cstring>
#include <ctime>

#include <QNEthernet.h>

using namespace qindesign::network;

// --------------------------------------------------------------------------
//  Configuration
// --------------------------------------------------------------------------

constexpr uint32_t kDHCPTimeout = 15000;  // 15 seconds

constexpr uint16_t kNTPPort = 3333;
// --------------------------------------------------------------------------
//  Program State
// --------------------------------------------------------------------------

namespace {  // Internal linkage section

// UDP port.
EthernetUDP udp;

// Buffer.
uint8_t buf[254];

}  // namespace

// --------------------------------------------------------------------------
//  Main Program
// --------------------------------------------------------------------------

// Program setup.
void setup() {
  Serial.begin(115200);
  while (!Serial && (millis() < 4000)) {
    // Wait for Serial
  }
  printf("Starting...\r\n");

  printf("Starting Ethernet with DHCP...\r\n");
  if (!Ethernet.begin()) {
    printf("Failed to start Ethernet\r\n");
    return;
  }
  uint8_t mac[6];
  Ethernet.macAddress(mac);  // This is informative; it retrieves, not sets
  printf("MAC = %02x:%02x:%02x:%02x:%02x:%02x\r\n",
         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  printf("Waiting for local IP...\r\n");
  if (!Ethernet.waitForLocalIP(kDHCPTimeout)) {
    printf("Failed to get IP address from DHCP\r\n");
    return;
  }

  IPAddress ip = Ethernet.localIP();
  printf("    Local IP    = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);
  ip = Ethernet.subnetMask();
  printf("    Subnet mask = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);
  ip = Ethernet.gatewayIP();
  printf("    Gateway     = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);
  ip = Ethernet.dnsServerIP();
  printf("    DNS         = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);

  // Start UDP listening on the NTP port
  udp.begin(kNTPPort);

  // Send an SNTP request

  std::memset(buf, 0, 254);

   // Send the packet
  printf("Sending SNTP request to the gateway...");
 

   udp.beginPacket(Ethernet.gatewayIP(), kNTPPort);
   udp.write(buf, 48);
   udp.endPacket();
   printf("\r\n");
   printf("Started listening\r\n");
}

// Main program loop.
void loop() {
  // 1. RECEIVE DATA
  // Check if a packet has arrived
  int packetSize = udp.parsePacket();
 
  if (packetSize) {
    Serial.printf("Received %d bytes: %d\n", packetSize);
  }
}
 
Last edited:
No Help here - where is SECRETS to join network?
Also I playing around and it keeps hanging at
Check loop() code - two %d and one param? and changed to >0 test as it was blasting SerMon:
Code:
// Main program loop.
void loop() {
  // 1. RECEIVE DATA
  // Check if a packet has arrived
  int packetSize = udp.parsePacket();

  if (packetSize > 0) {
    Serial.printf("Received bytes: %d\n", packetSize);
  }
}
 
@mjs513

Modify this to work?:
T:\T_Drive\tCode\libraries\QNEthernet_WIFI\src\qnethernet\drivers\cyw4343w\src\secrets.h
Look for connect at: Joining network FiberEagle

Looks like port # is 3333? Not getting a result from send


Code:
Starting...
Starting Ethernet with DHCP...
===========================
CYW4343W Card::begin: SDIO2
===========================
Attaching OOB interrupt to pin 34
Enabled CYW4343W bus high speed interface
BUS_IORDY_REG (Ready indication) returned OK
SDHC bus set to 4-bit, speed set to 33MHz
*************
CardID: 43430
*************
Set SRAM_IOCTRL_REG validated
Set SRAM_IOCTRL_REG second validation
Set SRAM_RESETCTRL_REG validated
Uploading firmware data
Uploaded firmware, 419798 of 419798 bytes
Uploading NVRAM data
Uploaded NVRAM, 680 of 680 bytes
Set BAK_CHIP_CLOCK_CSR_REG validated
Set BUS_IORDY_REG validated
Configuring WL_IRQ OOB
==============================
End W4343WCard::begin: SDIO2
==============================
driver_get_system_mac
Uploading CLM, size: 7222
CLM uploaded 7222/7222 result: 1
CLM version API: 12.2
Data: 9.10.39
Compiler: 1.29.4
ClmImport: 1.36.3
Creation: 2020-02-16 22:32:13

In joinNetworks
WiFi CPU running
Set country succesfully
Join events enabled
Joining network FiberEagle

********************* LINK Established *********************

********************* Joined Network ***********************

Initialization Done
MAC = 70:87:a7:11:98:a5
Waiting for local IP...
Setting link up
    Local IP    = 10.168.168.215
    Subnet mask = 255.255.255.0
    Gateway     = 10.168.168.1
    DNS         = 10.168.168.1
Sending SNTP request to the gateway...
Started listening
 
Modify this to work?:
T:\T_Drive\tCode\libraries\QNEthernet_WIFI\src\qnethernet\drivers\cyw4343w\src\secrets.h
Look for connect at: Joining network FiberEagle

Looks like port # is 3333? Not getting a result from send
Had the example working yesterday but the today had an issue - so just had to rewire and it worked with your changes.
 
p#156 code with this loop()
Code:
// Main program loop.
void loop() {
  // 1. RECEIVE DATA
  // Check if a packet has arrived
  int packetSize = udp.parsePacket();

  if (packetSize > 0) {
    Serial.printf("Received bytes: %d:: ", packetSize);
    char *pd = udp.data();
    for (int ii=0; ii< packetSize; ii++) {
      Serial.print( pd[ii]);
    }
    Serial.println();
  }
}
Using "Packet Sender":
Code:
Waiting for local IP...
Setting link up
    Local IP    = 10.168.168.215
    Subnet mask = 255.255.255.0
    Gateway     = 10.168.168.1
    DNS         = 10.168.168.1
Sending SNTP request to the gateway...
Started listening
Received bytes: 7:: 1234abc
Received bytes: 239:: Memory Usage on Teensy 4.1:
  FLASH: code:128488, data:449100, headers:9160   free for files:7539716
   RAM1: variables:36576, code:124816, padding:6256   free for local variables:356640
   RAM2: variables:40352  free for malloc/new:483936
 
Update:
1781208765729.png


Teensy Full Sketch

C++:
// SPDX-FileCopyrightText: (c) 2021-2026 Shawn Silverman <shawn@pobox.com>
// SPDX-License-Identifier: AGPL-3.0-or-later

// SNTPClient demonstrates a simple SNTP client.
// See: https://tools.ietf.org/html/rfc4330
//
// This file is part of the QNEthernet library.

// C includes
#include <sys/time.h>
// Assume settimeofday() exists

// C++ includes
#include <cerrno>
#include <cstring>
#include <ctime>

#include <QNEthernet.h>

using namespace qindesign::network;

// --------------------------------------------------------------------------
//  Configuration
// --------------------------------------------------------------------------

constexpr uint32_t kDHCPTimeout = 15000;  // 15 seconds

constexpr uint16_t kNTPPort = 3333;
// --------------------------------------------------------------------------
//  Program State
// --------------------------------------------------------------------------

namespace {  // Internal linkage section

// UDP port.
EthernetUDP udp;

// Buffer.
uint8_t packetBuffer[254];

}  // namespace

// --------------------------------------------------------------------------
//  Main Program
// --------------------------------------------------------------------------

const char* udpAddress = "192.168.1.221";

// Program setup.
void setup() {
  Serial.begin(115200);
  while (!Serial && (millis() < 4000)) {
    // Wait for Serial
  }
  printf("Starting...\r\n");

  printf("Starting Ethernet with DHCP...\r\n");
  if (!Ethernet.begin()) {
    printf("Failed to start Ethernet\r\n");
    return;
  }
  uint8_t mac[6];
  Ethernet.macAddress(mac);  // This is informative; it retrieves, not sets
  printf("MAC = %02x:%02x:%02x:%02x:%02x:%02x\r\n",
         mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  printf("Waiting for local IP...\r\n");
  if (!Ethernet.waitForLocalIP(kDHCPTimeout)) {
    printf("Failed to get IP address from DHCP\r\n");
    return;
  }

  IPAddress ip = Ethernet.localIP();
  printf("    Local IP    = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);
  ip = Ethernet.subnetMask();
  printf("    Subnet mask = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);
  ip = Ethernet.gatewayIP();
  printf("    Gateway     = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);
  ip = Ethernet.dnsServerIP();
  printf("    DNS         = %u.%u.%u.%u\r\n", ip[0], ip[1], ip[2], ip[3]);

  // Start UDP listening on the NTP port
  udp.begin(kNTPPort);

  // Send an SNTP request

  std::memset(packetBuffer, 0, 254);

   // Send the packet
  printf("Sending SNTP request to the gateway...");
 

   udp.beginPacket(udpAddress, kNTPPort);
   udp.write(packetBuffer, 48);
   udp.endPacket();
   printf("\r\n");
   printf("Started listening\r\n");
}

// Main program loop.
void loop() {
  // 1. RECEIVE DATA
  // Check if a packet has arrived
  int packetSize = udp.parsePacket();
 
  if (packetSize > 0) {
    Serial.printf("Received %d bytes: \n", packetSize);
  // Read the packet into packetBuffer
    int len = udp.read(packetBuffer, 255);
    if (len > 0) {
      packetBuffer[len] = 0; // Null-terminate the string
    }
    Serial.printf("Packet contents: %s\n", packetBuffer);
  }

 // 2. SEND DATA (Every 5 seconds)
  static unsigned long lastSendTime = 0;
  if (millis() - lastSendTime > 5000) {
    lastSendTime = millis();

    Serial.println("Sending periodic UDP packet...");
   
    // Initialize packet transmission to target IP and port
    udp.beginPacket(udpAddress, kNTPPort);
   
    // Print formatted data directly into the packet
    udp.printf("Hello from Teensy 4.1! Uptime: %lu seconds", millis() / 1000);
   
    // Finalize and transmit the packet
    udp.endPacket();
  }
}

Pretty much same code on esp32
C++:
#include <WiFi.h>
#include <WiFiUdp.h>

// Network credentials
const char* ssid     = "";
const char* password = "";

// UDP settings
const unsigned int localPort = 3333;      // Port the ESP32 listens on
const char* udpAddress = "192.168.1.222"; // Target IP address to send data to
const int remotePort = 3333;              // Target port to send data to

// UDP instance
WiFiUDP udp;

// Packet buffers
char packetBuffer[255];
char replyBuffer[] = "Message received!";

void setup() {
  // Initialize serial communication
  Serial.begin(115200);

  // Connect to Wi-Fi network
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WiFi");
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
 
  Serial.println("");
  Serial.println("WiFi connected!");
  Serial.print("ESP32 IP Address: ");
  Serial.println(WiFi.localIP());

  // Start listening on the specified UDP port
  udp.begin(localPort);
  Serial.print("Listening on UDP port ");
  Serial.println(localPort);
}

void loop() {
  // 1. RECEIVE DATA
  // Check if a packet has arrived
  int packetSize = udp.parsePacket();
 
  if (packetSize) {
    Serial.printf("Received %d bytes from %s, port %d\n",
                  packetSize,
                  udp.remoteIP().toString().c_str(),
                  udp.remotePort());
   
    // Read the packet into packetBuffer
    int len = udp.read(packetBuffer, 255);
    if (len > 0) {
      packetBuffer[len] = 0; // Null-terminate the string
    }
    Serial.printf("Packet contents: %s\n", packetBuffer);

    // Optional: Send an automatic reply back to the sender
    udp.beginPacket(udp.remoteIP(), udp.remotePort());
    udp.write((uint8_t*)replyBuffer, strlen(replyBuffer));
    udp.endPacket();
  }

  // 2. SEND DATA (Every 5 seconds)
  static unsigned long lastSendTime = 0;
  if (millis() - lastSendTime > 5000) {
    lastSendTime = millis();

    Serial.println("Sending periodic UDP packet...");
   
    // Initialize packet transmission to target IP and port
    udp.beginPacket(udpAddress, remotePort);
   
    // Print formatted data directly into the packet
    udp.printf("Hello from ESP32! Uptime: %lu seconds", millis() / 1000);
   
    // Finalize and transmit the packet
    udp.endPacket();
  }
}

Maybe tomorrow with try with real data :)
 
Ok, I found our schematic:
View attachment 39480
Also, here is a link to my GitHub repo containing most of the information we all collected. It may be of use to you...
EDIT: It looks like we are using the HOST_WAKE pin for int. 1DX pin #27.

Very helpful, thank you!

Ok, here's a quickly-put-together schematic and board layout. Haven't yet done any controlled impedance or length matching for traces, and definitely need more GND vias. Will do that later, want to first get feedback to confirm everything else seems good.

1781213152151.png


1781213322979.png


1781213352522.png


Lmk your thoughts! Thanks!
 
How Would I mount this? Above or below the Teensy?

Access to the USB Host pins? Other through hole pins on Teensy?
SDCard?

That is suppose I wish to use this with an Audio board (mostly likely not be) and have USB Host pins as well as access to SD slot
 
How Would I mount this? Above or below the Teensy?

Access to the USB Host pins? Other through hole pins on Teensy?
SDCard?

That is suppose I wish to use this with an Audio board (mostly likely not be) and have USB Host pins as well as access to SD slot
To continue this line of questioning, @sparkfro, I'd likely be attaching an OctoWS2811 board too. How would this fit in there?
 
Sorry, wondering if this chip also does Bluetooth? Again it looks similar to the one in the Nicla Vision and probably others:
From the earlier schematic:
1781268676586.png


From the Nicla Vision schematic: https://docs.arduino.cc/resources/schematics/ABX00051-schematics.pdf
1781268728454.png

And I see signals setup for example to turn blue tooth on. Question is, if the chosen chip supports it, is there a reason you would not
want to make it somehow useable?

EDIT: I see @mjs513 already mentioned that the GIGA uses it as well, so does the Arduino Portenta H7. Good news with all of this is that
there should be libraries to support these chips, both WIFI and BT. For both Arduino IDE and Zephyr.
 
Last edited:
Sorry, wondering if this chip also does Bluetooth? Again it looks similar to the one in the Nicla Vision and probably others:
believe the 1dx does support bluetooth. Its the same chip as on on the giga if I remember right>
Rich (BB code):
Murata® 1DX Wi-Fi®/Bluetooth® Module
Wi-Fi® 802.11b/g/n 65 Mbps
Bluetooth® Low Energy (version 5.X via Cordio stack, version 4.2 via Arduino Stack)
Micro UFL connector for external antenna

Giga R1 schematic
1781269326910.png

And it looks like you just need to bring out 2 more pins BT_WAKE_H and BT_WAKE_L
 
Great questions, thank you! I'll admit that I've really not used Teensy much myself, so this is great to understand some use cases and interactions with other hardware. Please feel free to bring up other use cases and potential hardware combinations!

How Would I mount this? Above or below the Teensy?

Access to the USB Host pins? Other through hole pins on Teensy?
SDCard?

That is suppose I wish to use this with an Audio board (mostly likely not be) and have USB Host pins as well as access to SD slot

We can offer stackable headers, like we have for this Qwiic shield. This enables you to attach it above or below, you decide! Though if you have a Teensy 4.1 with headers pre-soldered, then you'd have to put the shield below. I am curious to know if there's a preference of putting it above or below.

For the USB host pins, we could potentially add pass-through PTH pads there for you to add stackable headers, or simply a cutout for headers to pass through. Any preference?

The SD card slot should be fully accessible and usable with the shield attached on the top or bottom, no physical obstructions nor electrical conflicts.

We can potentially also add a cutout that's aligned with the button, so if the shield is added on top, then you could at least use a pencil or something to press the button.

To continue this line of questioning, @sparkfro, I'd likely be attaching an OctoWS2811 board too. How would this fit in there?

I think this should be doable with the right combination of headers to get enough height clearance and get all the electrical passthrough. I'll need to check the pinout of the OctoWS2811 to ensure no pin conflicts.

Sorry, wondering if this chip also does Bluetooth? Again it looks similar to the one in the Nicla Vision and probably others:
From the earlier schematic:
View attachment 39492

From the Nicla Vision schematic: https://docs.arduino.cc/resources/schematics/ABX00051-schematics.pdf
View attachment 39493
And I see signals setup for example to turn blue tooth on. Question is, if the chosen chip supports it, is there a reason you would not
want to make it somehow useable?

EDIT: I see @mjs513 already mentioned that the GIGA uses it as well, so does the Arduino Portenta H7. Good news with all of this is that
there should be libraries to support these chips, both WIFI and BT. For both Arduino IDE and Zephyr.

Yep, the chip supports Bluetooth, and I've routed out the UART and I2S pins on the shield design.

believe the 1dx does support bluetooth. Its the same chip as on on the giga if I remember right>
Rich (BB code):
Murata® 1DX Wi-Fi®/Bluetooth® Module
Wi-Fi® 802.11b/g/n 65 Mbps
Bluetooth® Low Energy (version 5.X via Cordio stack, version 4.2 via Arduino Stack)
Micro UFL connector for external antenna

Giga R1 schematic
View attachment 39494
And it looks like you just need to bring out 2 more pins BT_WAKE_H and BT_WAKE_L

Good catch, I will route the other BT_WAKE pin as well!
 
Great questions, thank you! I'll admit that I've really not used Teensy much myself, so this is great to understand some use cases and interactions with other hardware. Please feel free to bring up other use cases and potential hardware combinations!
For me, I would probably use it in one of the simple boards @Paul has made in the past, like:
1781294320840.png

Would be great if Sparkfun sold some like these.
Especially the later ones that have qwiic connectors.

Sorry for the dust in the image
 
one of the simple boards
Was going to post the same - but mine might be no more photogenic :)
Those PJRC header array boards are typically awesome.

For Proto purposes to get the software working/refined the format isn't critical - we can adapt or use a fresh T_4.1.
The T_4.1 chock full of pins and features makes a simple answer unclear using the SDIO2 pin set and more.
 
I note the plan to have the aerial directly above (or below) the metal can of the SD Card reader. How will this affect the aerial performance?
 
Would be great if Sparkfun sold some like these.

Maybe @gigapod might be interested?

Design-wise, it's only 10 sockets, 2 headers, and 3 QWIIC connectors. But for soldering, something needs to be in those sockets to hold them straight. Every time I've hand soldered these boards, I put a pair of long header pins into both sides of all the sockets.

The laser cut base has 5 tapped holes. If SparkFun sold a similar base, maybe they'd opt for different hardware? The weight of a ~5 mm thick acrylic base and 4 rubber feet really adds a convenience factor of keeping stuff from moving around while testing hardware.
 
Back
Top