diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 980b3c1..2d2b7ed 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -42,9 +42,15 @@ jobs: - fqbn: arduino:renesas_uno:unor4wifi platforms: | - name: arduino:renesas_uno + - fqbn: arduino:renesas_portenta:portenta_c33 + platforms: | + - name: arduino:renesas_portenta - fqbn: arduino:mbed_giga:giga platforms: | - name: arduino:mbed_giga + - fqbn: arduino:mbed_portenta:envie_m7 + platforms: | + - name: arduino:mbed_portenta steps: - name: Checkout diff --git a/examples/UDP_Client/UDP_Client.ino b/examples/UDP_Client/UDP_Client.ino index a420f5e..e34eb4f 100644 --- a/examples/UDP_Client/UDP_Client.ino +++ b/examples/UDP_Client/UDP_Client.ino @@ -35,7 +35,7 @@ static uint16_t const UDP_SERVER_PORT = 8888; **************************************************************************************/ auto const tc6_io = new TC6::TC6_Io( -#ifdef ARDUINO_GIGA +#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33) SPI1 #else SPI diff --git a/examples/UDP_Server/UDP_Server.ino b/examples/UDP_Server/UDP_Server.ino index d694f4d..a552952 100644 --- a/examples/UDP_Server/UDP_Server.ino +++ b/examples/UDP_Server/UDP_Server.ino @@ -39,7 +39,7 @@ static uint16_t const UDP_SERVER_LOCAL_PORT = 8888; **************************************************************************************/ auto const tc6_io = new TC6::TC6_Io( -#ifdef ARDUINO_GIGA +#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33) SPI1 #else SPI diff --git a/examples/iperf-client/iperf-client.ino b/examples/iperf-client/iperf-client.ino index cb34ee6..086d700 100644 --- a/examples/iperf-client/iperf-client.ino +++ b/examples/iperf-client/iperf-client.ino @@ -42,7 +42,7 @@ static T1SMacSettings const t1s_mac_settings{MAC_PROMISCUOUS_MODE, MAC_TX_CUT_TH **************************************************************************************/ auto const tc6_io = new TC6::TC6_Io( -#ifdef ARDUINO_GIGA +#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33) SPI1 #else SPI diff --git a/examples/tools/Control-DIOx/Control-DIOx.ino b/examples/tools/Control-DIOx/Control-DIOx.ino index 86662aa..113f1b1 100644 --- a/examples/tools/Control-DIOx/Control-DIOx.ino +++ b/examples/tools/Control-DIOx/Control-DIOx.ino @@ -36,7 +36,7 @@ static auto const DIO_PIN = TC6::DIO::A0; **************************************************************************************/ auto const tc6_io = new TC6::TC6_Io( -#ifdef ARDUINO_GIGA +#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33) SPI1 #else SPI diff --git a/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino b/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino index 0ff5a67..4047e6a 100644 --- a/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino +++ b/examples/tools/PoDL-Sink-Auto-TurnOff/PoDL-Sink-Auto-TurnOff.ino @@ -33,7 +33,7 @@ static T1SMacSettings const t1s_default_mac_settings; **************************************************************************************/ auto const tc6_io = new TC6::TC6_Io( -#ifdef ARDUINO_GIGA +#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33) SPI1 #else SPI diff --git a/examples/tools/PoDL-Source/PoDL-Source.ino b/examples/tools/PoDL-Source/PoDL-Source.ino index eb866dd..6292f47 100644 --- a/examples/tools/PoDL-Source/PoDL-Source.ino +++ b/examples/tools/PoDL-Source/PoDL-Source.ino @@ -33,7 +33,7 @@ static T1SMacSettings const t1s_default_mac_settings; **************************************************************************************/ auto const tc6_io = new TC6::TC6_Io( -#ifdef ARDUINO_GIGA +#if defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_C33) SPI1 #else SPI diff --git a/library.properties b/library.properties index b949f3a..3ebb7a8 100644 --- a/library.properties +++ b/library.properties @@ -6,4 +6,4 @@ sentence=Generic library for providing IP based 10BASE-T1S communication. paragraph=This Arduino library provides both low-level drivers and high-level abstractions to perform real-time communication via 10BASE-T1S, a multi-drop capable Ethernet standard. category=Communication url=https://github.com/arduino-libraries/Arduino_10BASE_T1S -architectures=samd,renesas_uno,mbed_giga \ No newline at end of file +architectures=samd,renesas_uno,renesas_portenta,mbed_giga,mbed_portenta diff --git a/src/Arduino_10BASE_T1S.h b/src/Arduino_10BASE_T1S.h index 78d7306..8f1d1a3 100644 --- a/src/Arduino_10BASE_T1S.h +++ b/src/Arduino_10BASE_T1S.h @@ -40,6 +40,17 @@ static int const IRQ_PIN = 2; static int const CS_PIN = 9; static int const RESET_PIN = 4; static int const IRQ_PIN = 2; +#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) +/* Pro Demo kit on MID carrier, UNO form factor */ +#include "pinDefinitions.h" +static int const CS_PIN = PinNameToIndex(PH_6); +static int const RESET_PIN = PinNameToIndex(PJ_11); +static int const IRQ_PIN = PinNameToIndex(PC_7); +#elif defined(ARDUINO_PORTENTA_C33) +/* Pro Demo kit on MID carrier, UNO form factor */ +static int const CS_PIN = 25; +static int const RESET_PIN = 4; +static int const IRQ_PIN = 2; #else # error "No pins defined for your board" #endif diff --git a/src/MacAddress.cpp b/src/MacAddress.cpp index fa7ab24..682b9b9 100644 --- a/src/MacAddress.cpp +++ b/src/MacAddress.cpp @@ -82,26 +82,16 @@ void get_unique_chip_id_3(uint8_t * uid) uint32_t const samd_uid = *(volatile uint32_t*)(0x0080A048); memcpy(uid, &samd_uid, 3); } -#elif defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) +#elif defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33) { - #define BSP_FEATURE_BSP_MCU_INFO_POINTER_LOCATION (0x407FB19C) - #define BSP_FEATURE_BSP_UNIQUE_ID_OFFSET (0x14) - #define BSP_FEATURE_BSP_UNIQUE_ID_POINTER ((*(uint32_t *) BSP_FEATURE_BSP_MCU_INFO_POINTER_LOCATION) \ - + \ - BSP_FEATURE_BSP_UNIQUE_ID_OFFSET) - typedef struct st_bsp_unique_id - { - union - { - uint32_t unique_id_words[4]; - uint8_t unique_id_bytes[16]; - }; - } bsp_unique_id_t; - - bsp_unique_id_t const * renesas_unique_id = (bsp_unique_id_t *) BSP_FEATURE_BSP_UNIQUE_ID_POINTER; - memcpy(uid, renesas_unique_id->unique_id_bytes, 3); + const bsp_unique_id_t* t = R_BSP_UniqueIdGet(); + memcpy(uid, t->unique_id_bytes, 3); + } +#elif defined(ARDUINO_GIGA) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) + { + uint32_t const stm32_uid = HAL_GetUIDw2(); + memcpy(uid, &stm32_uid, 3); } -#elif defined(ARDUINO_GIGA) { auto stm32_uid = HAL_GetUIDw2(); memcpy(uid, &stm32_uid, 3); @@ -109,4 +99,10 @@ void get_unique_chip_id_3(uint8_t * uid) #else # error "Retrieving a unique chip ID for MAC generation is not supported on this platform." #endif -} \ No newline at end of file +} + +#if defined(ARDUINO_PORTENTA_C33) +extern "C" int LWIP_RAND() { + return rand(); +} +#endif