Skip to content

Commit

Permalink
Port to Portenta C33 and simplify uniqueID for Renesas platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Oct 9, 2024
1 parent 2a5425b commit 1238ad3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/Arduino_10BASE_T1S.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ static int const IRQ_PIN = 2;
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
28 changes: 10 additions & 18 deletions src/MacAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,24 +82,10 @@ 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)
{
Expand All @@ -113,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
}
}

#if defined(ARDUINO_PORTENTA_C33)
extern "C" int LWIP_RAND() {
return rand();
}
#endif

0 comments on commit 1238ad3

Please sign in to comment.