Skip to content

Commit c89c629

Browse files
authored
Merge pull request #904 from mbrossard/feature/lpc4322_hic
SWO support for LPC4322 and other enhancements (non-exhaustive list): - Update CMSIS DFP files - Increase core clock to 120 MHz - Improved GCC linker scripts
2 parents c455793 + ad6df73 commit c89c629

23 files changed

+31946
-34787
lines changed

docs/hic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
| [kl26z](kl26z.md) | M0+ | 48 Mhz | 16 KB | 128 KB | FS |
88
| [kl27z](kl27z.md) | M0+ | 48 Mhz | 32 KB | 128 KB | FS |
99
| [lpc11u35](lpc11u35.md) | M0 | 48 Mhz | 12 KB | 64 KB | FS |
10-
| [lpc4322](lpc4322.md) | M4 | 96 MHz | 256 KB | 256 KB | HS |
10+
| [lpc4322](lpc4322.md) | M4 | 120 MHz | 256 KB | 256 KB | HS |
1111
| [lpc55xx](lpc55xx.md) | M33 | 150 MHz | 272 KB | 320 KB | HS |
1212
| [max32625](max32625.md) | M4 | 96 MHz | 160 KB | 512 KB | FS |
1313
| [nrf52820](nrf52820.md) | M4 | 64 MHz | 32 KB | 256 KB | FS |

docs/hic/lpc4322.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# lpc4322 HIC
22

33
Based on LPC4322JET100E chip ([Data Sheet](https://www.nxp.com/docs/en/data-sheet/LPC435X_3X_2X_1X.pdf)):
4-
- Cortex-M4 204 Mhz
4+
- Cortex-M4 204 Mhz (currently run at 120 MHz)
55
- 512 KB Flash
66
- 104 KB RAM
77
- High-speed USB 2.0 device controller
@@ -16,7 +16,7 @@ Based on LPC4322JET100E chip ([Data Sheet](https://www.nxp.com/docs/en/data-shee
1616

1717
Bootloader size is 64 KB
1818

19-
## DAPLink default pin assignment
19+
## DAPLink default pin assignment
2020

2121
| Signal | I/O | Symbol | Pin |
2222
|-------------|:---:|---------|:---:|

records/board/lpc55S69xpresso.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
common:
2+
macros:
3+
- SWO_UART=1
24
sources:
35
board:
46
- source/board/lpc55S69xpresso.c

records/hic_hal/lpc4322.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ common:
88
- CORE_M4
99
- INTERNAL_FLASH
1010
- DAPLINK_HIC_ID=0x97969905 # DAPLINK_HIC_ID_LPC4322
11-
- OS_CLOCK=96000000
11+
- OS_CLOCK=120000000
1212
includes:
1313
- source/hic_hal/nxp/lpc4322
14+
- source/hic_hal/nxp/lpc4322/RTE_Driver
1415
sources:
1516
hic_hal:
1617
- source/hic_hal/nxp/lpc4322
18+
- source/hic_hal/nxp/lpc4322/RTE_Driver
1719

1820
tool_specific:
1921
uvision:
@@ -32,6 +34,8 @@ tool_specific:
3234
hic_hal:
3335
- source/hic_hal/nxp/lpc4322/armcc
3436
gcc_arm:
37+
linker_file:
38+
- source/hic_hal/nxp/lpc4322/gcc/lpc4322.ld
3539
sources:
3640
hic_hal:
3741
- source/hic_hal/nxp/lpc4322/gcc

source/hic_hal/nxp/lpc4322/DAP_config.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,16 @@ typedef unsigned int BOOL;
9797
/// This configuration settings is used to optimize the communication performance with the
9898
/// debugger and depends on the USB peripheral. For devices with limited RAM or USB buffer the
9999
/// setting can be reduced (valid range is 1 .. 255). Change setting to 4 for High-Speed USB.
100-
#define DAP_PACKET_COUNT 1 ///< Buffers: 64 = Full-Speed, 4 = High-Speed.
100+
#define DAP_PACKET_COUNT 8 ///< Buffers: 64 = Full-Speed, 4 = High-Speed.
101101

102102
/// Indicate that UART Serial Wire Output (SWO) trace is available.
103103
/// This information is returned by the command \ref DAP_Info as part of <b>Capabilities</b>.
104+
#if !defined(SWO_UART)
104105
#define SWO_UART 0 ///< SWO UART: 1 = available, 0 = not available
106+
#endif
105107

106108
/// USART Driver instance number for the UART SWO.
107-
#define SWO_UART_DRIVER 0 ///< USART Driver instance number (Driver_USART#).
109+
#define SWO_UART_DRIVER 1 ///< USART Driver instance number (Driver_USART#).
108110

109111
/// Maximum SWO UART Baudrate
110112
#define SWO_UART_MAX_BAUDRATE 10000000U ///< SWO UART Maximum Baudrate in Hz
@@ -156,8 +158,6 @@ typedef unsigned int BOOL;
156158
// State of Reset Ouput Enable buffer
157159
extern bool gpio_reset_pin_is_input;
158160

159-
160-
161161
//**************************************************************************************************
162162
/**
163163
\defgroup DAP_Config_PortIO_gr CMSIS-DAP Hardware I/O Pin Access
@@ -440,6 +440,11 @@ It is recommended to provide the following LEDs for status indication:
440440
*/
441441
__STATIC_INLINE void LED_CONNECTED_OUT(uint32_t bit)
442442
{
443+
if (bit) {
444+
X_SET(LED_CONNECTED);
445+
} else {
446+
X_CLR(LED_CONNECTED);
447+
}
443448
}
444449

445450
/** Debug Unit: Set status Target Running LED.

source/hic_hal/nxp/lpc4322/IO_Config.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_LPC4322);
4242
#define PIN_SWDIO_IN_BIT 9
4343
#define PIN_SWDIO (1<<PIN_SWDIO_IN_BIT)
4444

45+
// SWO Pin P1_14: GPIO1[7]
46+
#define PORT_SWO 1
47+
#define PIN_SWO_IN_BIT 7
48+
#define PIN_SWO (1<<PIN_SWO_IN_BIT)
49+
4550
// SWDIO Output Enable Pin P1_5: GPIO1[8]
4651
#define PORT_SWDIO_TXE 1
4752
#define PIN_SWDIO_TXE_IN_BIT 8
@@ -57,15 +62,27 @@ COMPILER_ASSERT(DAPLINK_HIC_ID == DAPLINK_HIC_ID_LPC4322);
5762
#define PIN_RESET_TXE_IN_BIT 6
5863
#define PIN_RESET_TXE (1<<PIN_RESET_TXE_IN_BIT)
5964

60-
// ISP Control Pin P2_11: GPIO1[11]
61-
#define ISPCTRL_PORT 1
62-
#define ISPCTRL_BIT 11
65+
// ISP Control Pin P2_11: GPIO1[11]
66+
#define PORT_ISPCTRL 1
67+
#define PIN_ISPCTRL_IN_BIT 11
68+
#define PIN_ISPCTRL (1<<PIN_ISPCTRL_IN_BIT)
69+
70+
// Connected LED P1_1: GPIO0[8]
71+
#define PORT_LED_CONNECTED 0
72+
#define PIN_LED_CONNECTED_IN_BIT 8
73+
#define PIN_LED_CONNECTED (1<<PIN_LED_CONNECTED_IN_BIT)
74+
75+
// Power Enable P3_1: GPIO5[8]
76+
#define PORT_POWER_EN 5
77+
#define PIN_POWER_EN_BIT 8
78+
#define PIN_POWER_EN (1<<PIN_POWER_EN_BIT)
6379

6480
#define X_SET(str) LPC_GPIO_PORT->SET[PORT_##str] = PIN_##str
6581
#define X_CLR(str) LPC_GPIO_PORT->CLR[PORT_##str] = PIN_##str
6682
#define X_DIR_OUT(str) LPC_GPIO_PORT->DIR[PORT_##str] |= (PIN_##str)
6783
#define X_DIR_IN(str) LPC_GPIO_PORT->DIR[PORT_##str] &= ~(PIN_##str)
6884
#define X_BYTE(str) LPC_GPIO_PORT->B[(PORT_##str << 5) + PIN_##str##_IN_BIT]
85+
#define X_WORD(str) LPC_GPIO_PORT->W[(PORT_##str << 5) + PIN_##str##_IN_BIT]
6986

7087

7188
#endif

0 commit comments

Comments
 (0)