Hello,
Does anybody have an example using the UART of LPC4357? I'm searching but with no success.
Any tip will be very helpful, Thanks.
That was my mistake! Thanks!
I was trying to use UART3 in P2_3 and P2_4, but they are connected to a USB port. The UART3 pins in the jumper of the kit are P9_3 and P9_4. Do you know how can I change the code so they work with the right pins?
-> change the code so they work with the right pins Sounds like it is your work.
But I can do that for you later when I have some time.
/** * SCU function and mode selection definitions * See the User Manual for specific modes and functions supoprted by the * various LPC18xx/43xx devices. Functionality can vary per device. */ #define SCU_MODE_PULLUP (0x0 << 3) /*!< Enable pull-up resistor at pad */ #define SCU_MODE_REPEATER (0x1 << 3) /*!< Enable pull-down and pull-up resistor at resistor at pad (repeater mode) */ #define SCU_MODE_INACT (0x2 << 3) /*!< Disable pull-down and pull-up resistor at resistor at pad */ #define SCU_MODE_PULLDOWN (0x3 << 3) /*!< Enable pull-down resistor at pad */ #define SCU_MODE_HIGHSPEEDSLEW_EN (0x1 << 5) /*!< Enable high-speed slew */ #define SCU_MODE_INBUFF_EN (0x1 << 6) /*!< Enable Input buffer */ #define SCU_MODE_ZIF_DIS (0x1 << 7) /*!< Disable input glitch filter */ #define SCU_MODE_4MA_DRIVESTR (0x0 << 8) /*!< Normal drive: 4mA drive strength */ #define SCU_MODE_8MA_DRIVESTR (0x1 << 8) /*!< Medium drive: 8mA drive strength */ #define SCU_MODE_14MA_DRIVESTR (0x2 << 8) /*!< High drive: 14mA drive strength */ #define SCU_MODE_20MA_DRIVESTR (0x3 << 8) /*!< Ultra high- drive: 20mA drive strength */ #define SCU_MODE_FUNC0 0x0 /*!< Selects pin function 0 */ #define SCU_MODE_FUNC1 0x1 /*!< Selects pin function 1 */ #define SCU_MODE_FUNC2 0x2 /*!< Selects pin function 2 */ #define SCU_MODE_FUNC3 0x3 /*!< Selects pin function 3 */ #define SCU_MODE_FUNC4 0x4 /*!< Selects pin function 4 */ #define SCU_MODE_FUNC5 0x5 /*!< Selects pin function 5 */ #define SCU_MODE_FUNC6 0x6 /*!< Selects pin function 6 */ #define SCU_MODE_FUNC7 0x7 /*!< Selects pin function 7 */ #define SCU_PINIO_FAST (SCU_MODE_INACT | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS)
/** * @brief Sets I/O Control pin mux * @param port : Port number, should be: 0..15 * @param pin : Pin number, should be: 0..31 * @param modefunc : OR'ed values or type SCU_MODE_* * @return Nothing * @note Do not use for clock pins (SFSCLK0 .. SFSCLK4). Use * Chip_SCU_ClockPinMux() function for SFSCLKx clock pins. */ STATIC INLINE void Chip_SCU_PinMuxSet(uint8_t port, uint8_t pin, uint16_t modefunc) { LPC_SCU->SFSP[port][pin] = modefunc; }
P9_3 -> SCU_MODE_FUNC7 -> U3_TXD — Transmitter output for USART3. P9_4 -> SCU_MODE_FUNC7 -> U3_RXD — Receiver input for USART3.
Thanks for your help! It finally worked.
The example was right, but I was using the wrong UART pins. I had to change the pinmux configuration as you said.