Skip to main content
Use this page to configure serial communication, set up threads and callbacks, handle errors, and tune SDK settings for the EMV Core RTOS SDK.
Check device status regularly, even when not performing transactions, to keep the UI in sync and surface error states. You cannot call any SDK API from within a callback.

Serial Interface Configuration

The SDK supports two serial communication modes. Select the one that matches your hardware connection.

UART Mode (Default)

Connect the UNO-mini via RS-232/TTL serial. Configure the device path and baud rate in the platform layer to match your hardware.

HID Mode

Connect the UNO-mini via USB HID. Each 64-byte report uses the first byte as a length indicator; remaining bytes carry the actual data.

Threading Requirements

The SDK requires dedicated background threads for communication. When EC_USE_DATALINK_PROTOCOL=1, two threads are required:
When EC_USE_DATALINK_PROTOCOL is disabled, only the maintenance thread is needed.

Callback Registration

All SDK operations are asynchronous. Register callbacks before initiating operations:

Error Handling

Check return values and implement proper error handling:

Configuration

Memory Management

Configure the memory allocation strategy in ecod_sdk_configs.h:

Buffer Sizes

Buffer sizes are defined in ecod_sdk_setup.h:
JSON-RPC overhead reduces usable payload by ~64 bytes. Socket data is hex-encoded, so effective throughput is halved.

Timeouts and Timing

Configure communication timeouts in ecod_sdk_configs.h:

Logging

Enable debug logging during development:

Integration Troubleshooting

Device Not Detected

Use these commands to check device visibility and permissions:

Serial Communication Failures

Check the following common causes:
  • Verify correct device path (/dev/ttyUSB0 vs /dev/hidraw0)
  • Check if another process is using the serial port
  • Ensure proper HID/UART mode selection in platform code
  • Verify baud rate settings match device configuration

Threading Issues

Check the following when threads are not behaving as expected:
  • Ensure the maintenance thread is running continuously
  • Check for mutex deadlocks in callback functions
  • Avoid blocking operations in callback handlers
  • Verify proper thread cleanup on application exit

Memory Issues

Check the following when experiencing memory-related failures:
  • Monitor buffer overflow with EC_MAX_BUFFER_SIZE
  • Check for memory leaks if using heap allocation
  • Ensure proper cleanup of SDK resources
  • Consider static allocation for embedded systems

Debug Logging

Enable comprehensive logging to diagnose issues:

Performance Tuning

Apply these adjustments to improve SDK responsiveness:
  • Keep maintenance thread sleep interval at 1 ms
  • Use static allocation for memory-constrained environments
  • Minimize callback processing time
  • Configure appropriate buffer sizes for your use case
  • Consider network bridge settings for socket-heavy applications

Migration Checklist (from SDK v0.9)

If upgrading from SDK v0.9, apply the following changes to your integration:
  1. Update emvCorePaymentParameters usage:
    • Remove fee_cents and currency_code fields.
    • Add is_final_amount and additional_receipt_data as needed. is_deferred is reserved for future use (RFU).
  2. Handle new Status code: Check for EC_DISABLED in status handling.
  3. Dual-thread mode: If using datalink protocol, implement a second thread calling EcodSdk_ProcessMessages().
  4. Update response handling: Take advantage of new fields in emvCorePaymentResponse.