Skip to content

Commit 29aa6d8

Browse files
authored
Merge pull request #13115 from NXPmicro/MXRT1050_USB
MIMXRT1050_EVK: Add USB support
2 parents 0bdc712 + 9e8998a commit 29aa6d8

30 files changed

+14084
-7
lines changed

features/nanostack/targets/TARGET_Freescale/TARGET_KW41Z/NanostackRfPhyKw41z.cpp

Lines changed: 1123 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2018 ARM Limited. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Licensed under the Apache License, Version 2.0 (the License); you may
5+
* not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#ifndef NANOSTACK_PHY_KW41Z_H_
18+
#define NANOSTACK_PHY_KW41Z_H_
19+
20+
#if MBED_CONF_RTOS_PRESENT
21+
#include "rtos/rtos.h"
22+
#endif
23+
#include "NanostackRfPhy.h"
24+
#include "fsl_common.h"
25+
26+
class NanostackRfPhyKw41z : public NanostackRfPhy {
27+
public:
28+
NanostackRfPhyKw41z();
29+
~NanostackRfPhyKw41z();
30+
int8_t rf_register();
31+
void rf_unregister();
32+
void get_mac_address(uint8_t *mac);
33+
void set_mac_address(uint8_t *mac);
34+
};
35+
36+
#endif /* NANOSTACK_PHY_KW41Z_H_ */

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/TARGET_EVK/mbed_overrides.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2020 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
56
* you may not use this file except in compliance with the License.
@@ -20,9 +21,17 @@
2021
#include "fsl_iomuxc.h"
2122
#include "fsl_gpio.h"
2223
#include "lpm.h"
24+
#include "usb_phy.h"
25+
#include "usb_device_config.h"
2326

2427
#define LPSPI_CLOCK_SOURCE_DIVIDER (7U)
2528
#define LPI2C_CLOCK_SOURCE_DIVIDER (5U)
29+
30+
/* USB PHY condfiguration */
31+
#define BOARD_USB_PHY_D_CAL (0x0CU)
32+
#define BOARD_USB_PHY_TXCAL45DP (0x06U)
33+
#define BOARD_USB_PHY_TXCAL45DM (0x06U)
34+
2635
uint8_t mbed_otp_mac_address(char *mac);
2736
void mbed_default_mac_address(char *mac);
2837

@@ -311,3 +320,28 @@ void mbed_default_mac_address(char *mac) {
311320

312321
return;
313322
}
323+
324+
void USB_DeviceClockInit(void)
325+
{
326+
usb_phy_config_struct_t phyConfig = {
327+
BOARD_USB_PHY_D_CAL,
328+
BOARD_USB_PHY_TXCAL45DP,
329+
BOARD_USB_PHY_TXCAL45DM,
330+
};
331+
332+
CLOCK_EnableUsbhs0PhyPllClock(kCLOCK_Usbphy480M, 480000000U);
333+
CLOCK_EnableUsbhs0Clock(kCLOCK_Usb480M, 480000000U);
334+
335+
USB_EhciPhyInit(CONTROLLER_ID, BOARD_XTAL0_CLK_HZ, &phyConfig);
336+
}
337+
338+
uint32_t USB_DeviceGetIrqNumber(void)
339+
{
340+
uint8_t irqNumber;
341+
342+
uint8_t usbDeviceEhciIrq[] = USBHS_IRQS;
343+
irqNumber = usbDeviceEhciIrq[CONTROLLER_ID - kUSB_ControllerEhci0];
344+
345+
return irqNumber;
346+
}
347+

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_MIMXRT1050/device/TOOLCHAIN_ARM_STD/MIMXRT1052xxxxx.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ LR_IROM1 MBED_APP_START m_text_start+m_text_size-MBED_APP_START { ; load regio
141141
}
142142
RW_m_ncache m_ncache_start m_ncache_size { ; ncache RW data
143143
* (NonCacheable.init)
144-
* (NonCacheable)
144+
* (*NonCacheable)
145145
}
146146
}
147147

0 commit comments

Comments
 (0)