|
HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
|
Comprehensive CAN testing suite for ESP32-C6 with ESP-IDF v5.5 TWAI API and SN65 transceiver. More...
#include "esp_log.h"#include "esp_timer.h"#include "freertos/FreeRTOS.h"#include "freertos/event_groups.h"#include "freertos/task.h"#include "TestFramework.h"#include "base/BaseCan.h"#include "mcu/esp32/EspCan.h"#include <atomic>#include <memory>#include <vector>Functions | |
| void | verify_can_pin_states () |
| Verify CAN pin states before testing. | |
| void | test_receive_callback_enhanced (const hf_can_message_t &message, void *user_data) |
| Test callback for received CAN messages (enhanced version with user data) | |
| hf_can_message_t | create_test_message (uint32_t id, bool extended=false, uint8_t dlc=8) |
| Create a test CAN message. | |
| bool | wait_for_event (EventBits_t bits, uint32_t timeout_ms) |
| Wait for events with timeout. | |
| bool | test_basic_initialization () noexcept |
| Test basic initialization and state management. | |
| bool | test_message_transmission () noexcept |
| Test message transmission and reception. | |
| bool | test_acceptance_filtering () noexcept |
| Test acceptance filtering. | |
| bool | test_advanced_timing () noexcept |
| Test advanced timing configuration. | |
| bool | test_statistics_diagnostics () noexcept |
| Test statistics and diagnostics. | |
| bool | test_batch_transmission () noexcept |
| Test batch message transmission. | |
| bool | test_error_handling () noexcept |
| Test error handling and recovery. | |
| bool | test_espcan_comprehensive_functionality () noexcept |
| Comprehensive test to validate ALL EspCan functionality This test systematically validates every aspect of the EspCan implementation. | |
| bool | test_can_initialization () noexcept |
| bool | test_can_self_test_mode () noexcept |
| bool | test_can_message_transmission () noexcept |
| bool | test_can_acceptance_filtering () noexcept |
| bool | test_can_advanced_timing () noexcept |
| bool | test_can_error_handling () noexcept |
| bool | test_can_bus_recovery () noexcept |
| bool | test_can_batch_transmission () noexcept |
| bool | test_can_high_throughput () noexcept |
| bool | test_external_physical_loopback () noexcept |
| bool | test_loopback_comparison () noexcept |
| bool | test_sn65_transceiver_integration () noexcept |
| bool | test_can_signal_quality () noexcept |
| void | app_main (void) |
Variables | |
| static const char * | TAG = "CAN_Test" |
| static TestResults | g_test_results |
| static constexpr uint32_t | TEST_CAN_ID_STANDARD = 0x123 |
| static constexpr uint32_t | TEST_CAN_ID_EXTENDED = 0x12345678 |
| static constexpr uint32_t | TEST_BAUD_RATE = 500000 |
| static constexpr uint32_t | TEST_TIMEOUT_MS = 5000 |
| static constexpr hf_pin_num_t | TEST_TX_PIN = 4 |
| static constexpr hf_pin_num_t | TEST_RX_PIN = 5 |
| static constexpr int | MESSAGE_RECEIVED_BIT = BIT0 |
| static constexpr int | ERROR_OCCURRED_BIT = BIT1 |
| static constexpr int | STATE_CHANGED_BIT = BIT2 |
| static EventGroupHandle_t | test_event_group = nullptr |
| static std::atomic< uint32_t > | messages_received {0} |
| static std::atomic< uint32_t > | errors_detected {0} |
| static hf_can_message_t | last_received_message {} |
| static constexpr bool | ENABLE_CORE_TESTS = true |
| static constexpr bool | ENABLE_ADVANCED_TESTS = true |
| static constexpr bool | ENABLE_ERROR_TESTS = true |
| static constexpr bool | ENABLE_PERFORMANCE_TESTS = true |
| static constexpr bool | ENABLE_TRANSCEIVER_TESTS |
Comprehensive CAN testing suite for ESP32-C6 with ESP-IDF v5.5 TWAI API and SN65 transceiver.
This comprehensive test suite validates all EspCan functionality including:
Hardware Requirements:
Wiring for ESP32-C6 + SN65:
For External Loopback Testing:
IMPORTANT: Two loopback modes are tested:
GPIO14 toggles HIGH/LOW after each test completion for visual feedback. Test sections are indicated by 5 blinks on GPIO14 (like SpiComprehensiveTest). This allows monitoring test progress without serial output.
| void app_main | ( | void | ) |
| hf_can_message_t create_test_message | ( | uint32_t | id, |
| bool | extended = false, | ||
| uint8_t | dlc = 8 ) |
Create a test CAN message.
|
noexcept |
Test acceptance filtering.
|
noexcept |
Test advanced timing configuration.
|
noexcept |
Test basic initialization and state management.
|
noexcept |
Test batch message transmission.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Test error handling and recovery.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Test message transmission and reception.
| void test_receive_callback_enhanced | ( | const hf_can_message_t & | message, |
| void * | user_data ) |
Test callback for received CAN messages (enhanced version with user data)
|
noexcept |
|
noexcept |
Test statistics and diagnostics.
| void verify_can_pin_states | ( | ) |
Verify CAN pin states before testing.
| bool wait_for_event | ( | EventBits_t | bits, |
| uint32_t | timeout_ms ) |
Wait for events with timeout.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
static |
|
static |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |