Mbed-os: USBSerial not working in for FRDM-K22f, MBED 5.13

Created on 14 Jul 2019  路  13Comments  路  Source: ARMmbed/mbed-os

Description

I'm trying to use USBSerial on the FRDM-K22F with latest MBED 5.13.
I'm exporting to MCUXpresso.

It is first throwing an error because it is calling USBPhy *get_usb_phy() over in mbed_usb_phy. This is due to the face that DEVICE_USBDEVICE is not defined, so it is calling this function rather than the one over in USBPhy_Kinetis.cpp

I noticed is DEVICE_USBDEVICE is not in my Makefile C_FLAGS
Going back to the targets.json I notice that "USBDEVICE" is not in the "device_has" for the MCU_K22F512.

I added DEVICE_USBDEVICE to the Makefile C_Flags. This got it to compile.

My code is this:

include "mbed.h"

include "USBSerial.h"

DigitalOut myled(LED2);
USBSerial serial(false, 0x1f00, 0x2012,0x0001);

int main() {
while(1) {
myled = 1;
wait(0.5);
myled = 0;
wait(0.5);
printf("std:Hello World\n");
serial.printf("USB:Hello World\n");
}
}

Doing a look on my mac with ls /dev/tty.usb* I see the USB for the debug connection and if I attach using screen then I see my expected output.

The USBSerial however does not get recognized by the system.

I had it working on this board with MBED2 (API was different on USBSerial constructor), but I really want to go forward with MBED5

Issue request type


[ ] Question
[ ] Enhancement
[x ] Bug

IOTOSM-2234 CLOSED mirrored bug

Most helpful comment

I wouldn't expect that it works as this target doesn't have USBDEVICE in target configuration (targets.json).
Freescale has generic implementation for few kinetics devices (USBPhy_Kinetis.cpp) but actually only K64F was tested that is why only K64F has USB enabled https://github.com/ARMmbed/mbed-os/blob/b82cfcc38be1b93fdb7a7192100569f060011569/targets/targets.json#L1521

@fkjagodzinski @c1728p9

All 13 comments

@maciejbocianski should this work for K22F?

cc @ARMmbed/team-nxp

I wouldn't expect that it works as this target doesn't have USBDEVICE in target configuration (targets.json).
Freescale has generic implementation for few kinetics devices (USBPhy_Kinetis.cpp) but actually only K64F was tested that is why only K64F has USB enabled https://github.com/ARMmbed/mbed-os/blob/b82cfcc38be1b93fdb7a7192100569f060011569/targets/targets.json#L1521

@fkjagodzinski @c1728p9

@maciejbocianski
If you look at my original report I noted that the USBDevice was not included in the targets.json

I assumed this was a temp problem that would be easily fixed. Is no one at NXP working on this?

So @ARMmbed/team-nxp are you still supporting MBED as a platform? Do you plan to get things up and working for MBED 5?

Should I be worried that ARMmbed/team-nxp gets a 404 error when you click the link? In NXP still supporting MBED?

@rkreifeldt I will take a look at this and get back to you.

Should I be worried that ARMmbed/team-nxp gets a 404 error when you click the link? In NXP still supporting MBED?

Teams are not publicly visible. they are.

@rkreifeldt I am working with the ARM team to enable USBDEVICE inside K22F. Current mbed USB test RAM requirements cannot be met by K22F.

Below PR to add USB support on K22F
https://github.com/ARMmbed/mbed-os/pull/11284

PR integrated. @rkreifeldt please retest on latest master and report back if any issues

Thanks I will, I assume I'll have to grab the latest master from Github instead of getting it from the online export tools.

Yes, I'll close this as resolved. IF there are issues, pls update

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2234

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1domen1 picture 1domen1  路  3Comments

cesarvandevelde picture cesarvandevelde  路  4Comments

drahnr picture drahnr  路  4Comments

0xc0170 picture 0xc0170  路  3Comments

neilt6 picture neilt6  路  4Comments