|
SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
|
The board can reach TESAIoT two ways. C3 covers MQTT; this covers the other.
Four things to know:
| MQTT (C3) | HTTPS (here) | |
|---|---|---|
| Shape | hold a connection, publish repeatedly | one request, then closed |
| Authentication | certificate in the chip (mTLS) | Device API Key |
| Can receive commands | yes, by subscribing | no |
| Memory cost | holds a TLS session throughout | all of it comes back |
| Suits | frequent sends, command handling | occasional sends, mostly-asleep devices |
Do not run both at once. Measured on a Dev Kit 2026-08-31: with MQTT connected the heap had 13,128 bytes free and malloc(32768) failed, so a second TLS session never reached its handshake. Without MQTT there were 71,712 bytes and it passed.
This is where the most time was lost, and the names do not help.
| config field | HTTP header sent | key shape | intended for |
|---|---|---|---|
| apisix_api_key | apikey: | tesa_ak_… | the APISIX gateway |
| api_key | whatever api_key_header says, X-API-KEY by default | tesa_dak_… | the platform backend |
ipc_tesaiot_defs.h:40 labels apisix_api_key "RESTful API key (tesa_ak_...)", which invites exactly the wrong choice.
On api.tesaiot.dev, use api_key. Measured with four curl variants: sending only the apikey header produces the same answer as sending no header at all — AUTH_MISSING in both cases — so there is no APISIX in front of that host.
The Device API Key comes from the platform's Device Credentials page and is shown once.
data must be an object. Flat values at the top level get:
On success:
tesaiot_https.c sets three socket options and no more — the CA to trust, the SNI name, and the verification mode. The CA is TESAIOT_HTTPS_ROOT_CA from tesaiot_https_root_ca.h.
It used to pin Let's Encrypt E7. The endpoint moved to a certificate under YE2, and every request then died at:
The board hung up before exchanging a byte of HTTP, which reads like a network fault and is in fact TLS working correctly.
It now pins ISRG Root YE, which issues YE2.
Why the root and not the intermediate. Intermediates rotate. Pinning one is what caused the outage above. Root YE runs to 2032-09-02.
Why not ISRG Root X1. It is RSA-4096, and verifying a certificate that size exhausts the heap on this part. Every certificate in the chain the server sends is ECDSA P-384, so that path is never taken.
How to check when you suspect the CA changed:
If the issuer is not the one pinned, the header has to change and the firmware has to be rebuilt.
When tls_mode is TESAIOT_MODE_MTLS, the HTTPS path calls mqtt_mtls_setup_optiga() to raise the OPTIGA identity before connecting. The name is misleading: nothing in that function is about MQTT. It reads the certificate out of the chip and hands it, with the key, to two globals in cy_tls.c that cy_tls_connect() consults on every connection.
It is declared weak and NULL-checked, so a build without that code still links and falls back to key authentication.
When it works:
It cannot yet authenticate anything. The server does not ask for a client certificate:
With no CertificateRequest, TLS sends no certificate, however ready the board is. The API's 401 text — "or use mTLS certificate" — is boilerplate, not a statement that this host has the mode enabled. It has to be turned on server-side.