Skip to content

Commit e07fc04

Browse files
committed
Bump version to 2.4 and document RTL8201F timing
Update the firmware version constant to "2.4" and rename SOFTWARE_VERSION to kSoftwareVersion, updating usages in Art-Net and sACN firmware mains. Add a detailed doxygen-style comment to rtl8201f CustomizedTiming that documents the RMSR timing fields, platform-specific RMII timing behavior, chosen RX/TX offset values for GD32F4 variants, and the masked read-modify-write update strategy. Also remove the -fprefetch-loop-arrays GCC optimize pragma from crc32.cpp.
1 parent 41945fd commit e07fc04

5 files changed

Lines changed: 56 additions & 5 deletions

File tree

firmware-template-gd32/include/software_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
#ifndef SOFTWARE_VERSION_H_
2727
#define SOFTWARE_VERSION_H_
2828

29-
constexpr char SOFTWARE_VERSION[] = "2.3";
29+
constexpr char kSoftwareVersion[] = "2.4";
3030

3131
#endif // SOFTWARE_VERSION_H_

gd32_emac_artnet_dmx_multi/firmware/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int main() // NOLINT
5555
DisplayUdf display;
5656
ConfigStore config_store;
5757
network::Init();
58-
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
58+
FirmwareVersion fw(kSoftwareVersion, __DATE__, __TIME__);
5959

6060
fw.Print("Art-Net 4 DMX/RDM controller {" STR(DMXNODE_PORTS) " Universes}");
6161

gd32_emac_e131_dmx_multi/firmware/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int main() // NOLINT
5959
DisplayUdf display;
6060
ConfigStore config_store;
6161
network::Init();
62-
FirmwareVersion fw(SOFTWARE_VERSION, __DATE__, __TIME__);
62+
FirmwareVersion fw(kSoftwareVersion, __DATE__, __TIME__);
6363

6464
fw.Print("sACN E1.31 DMX {" STR(DMXNODE_PORTS) " Universes}");
6565

lib-clib/src/crc32/crc32.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#pragma GCC push_options
1212
#pragma GCC optimize ("O2")
1313
#pragma GCC optimize ("-funroll-loops")
14-
#pragma GCC optimize ("-fprefetch-loop-arrays")
1514

1615
#include <cstdint>
1716
#include <cstddef>

lib-network/src/emac/phy/rtl8201f/phy.cpp

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,59 @@ void CustomizedLed()
8989
#define RMSR_TX_TIMING_SHIFT 8
9090
#define RMSR_TX_TIMING_MASK 0xF00
9191

92-
void CustomizedTiming()
92+
/**
93+
* @brief Apply RMII timing compensation for the RTL8201F PHY.
94+
*
95+
* The RTL8201F PHY provides programmable RMII interface timing adjustment
96+
* through the RMII Mode Setting Register (RMSR), located at page 7, register 16.
97+
*
98+
* Relevant RMSR fields:
99+
*
100+
* Bits [11:8] Rg_rmii_tx_offset RMII transmit timing offset
101+
* Bits [7:4] Rg_rmii_rx_offset RMII receive timing offset
102+
*
103+
* These fields allow the PHY to shift the internal sampling/drive timing
104+
* relative to the RMII 50 MHz reference clock. The RTL8201F datasheet specifies
105+
* a minimum timing adjustment resolution of approximately 2 ns per step.
106+
*
107+
* In principle the PHY default timing values are intended to be optimal,
108+
* however the effective RMII timing budget depends on the entire system:
109+
*
110+
* - MAC peripheral timing characteristics
111+
* - REFCLK distribution and clock phase
112+
* - GPIO pad delays
113+
* - PCB routing skew
114+
* - SoC internal bus and clock frequency
115+
*
116+
* Because of this, some platforms require PHY timing compensation to achieve
117+
* reliable RMII communication.
118+
*
119+
* In this implementation:
120+
*
121+
* GD32F1x7 and GD32F2x7 platforms operate correctly using the RTL8201F
122+
* default timing configuration and therefore require no adjustment.
123+
*
124+
* GD32F4xx platforms require modified RMII timing to ensure stable
125+
* Ethernet operation. The RX and TX offsets are therefore programmed
126+
* explicitly via the RMSR register.
127+
*
128+
* Selected values:
129+
*
130+
* RX offset: 0x4
131+
* TX offset:
132+
* GD32F407 -> 0x2 (system typically running at higher core clock)
133+
* GD32F470 -> 0x1
134+
* other F4 -> 0xF (fallback/default PHY setting)
135+
*
136+
* Only the RX/TX timing fields are modified. The register is updated using
137+
* a masked read-modify-write sequence so that other RMSR bits (RMII mode,
138+
* clock direction, CRS_DV behavior, etc.) remain unchanged.
139+
*
140+
* This configuration is platform-specific and compensates for MAC/PHY
141+
* interface timing differences on the GD32F4xx family.
142+
*/
143+
144+
void CustomizedTiming()
93145
{
94146
DEBUG_ENTRY();
95147
#if defined(GD32F4XX)

0 commit comments

Comments
 (0)