cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox General

New Contributor II

I am trying to get the USBFS_UART example working. This appears to be a variation of another. main.c says:

    "Description: This is the source code for the AnyCloud: BLE Battery Server. Example for ModusToolbox."

There are other references to the battery server.

Please note I am happy to switch over to another code example. I just need serial over USB. However, it is a bit disconcerting that example code which seems to be the correct on to use, has problems like this. Of course, I may be having a massive brainfart.

I started trying to use the Echo_CDC example, but it seemed to need the PSoC Creator. I will go back to trying that. I found

GitHub - cypresssemiconductorco/mtb-example-psoc6-usb-cdc-echo: This example demonstrates how to con... 

So: Please do not spend a lot of time on this. My primary goal is to report the issue. If I am doing something simple wrong, I would appreciate knowing about it. I am mainly trying to document. Of course, if the Echo CDC is a dead end, I will come back to this. There appears to not be any posts about this on this forum (I tried several searches).

I am happy to report it as a bug to the  http://openocd.org/doc/doxygen/bugs.html folks.

I am using the CY8CKIT-062-wifi-bt-fram pioneer kit

Loader MPU: CY8C5868LTI-LP039

Target MPU: CY8C6247BZI-D54

Code example: USBFS_UART

There are several problems. I was able to write and burn a blinky, so I know the toolchain and hardware works.

Please note I included as much information as I could. The verbose stuff is at the end.

I cannot see any other example that would allow the USB UART to do what I want: setup a com port I can then communicate over via putty. (If I get putty, I can do the rest.)  I then have everything I need to have an app on the chip to communicate with.

1. The biggest is I can execute the debug version.

The second its I cannot load the normal version - it appears to erase/burn correctly, but I then get an error and the blinky does its thing.

This tells me the code does not get loaded.

I suggest this is a bug - if the erase/burn does not happen, but the tool reports it was successful, there is a disconnect. The erase should report it was not successful. This could be because the erase is not actually dealing with the hardware, just being lied to by some intermediate emulation level.

However, I can download the debug version and step through/set breakpoints. I am assuming the debug version executes out of RAM. However,  I cannot see the COM port for the USB serial device. I have two USB "C" cables to two different USB ports. The cables are new. I switched them as a test. The COM3 is expected - it is the DAP device.

This tells me the debug version not only runs out of the RAM, but cannot access the target MPU hardware registers.

The PC has a hardware RS232 port as COM1

USB_UART_TEST1_no_serial_port.png

2: if you look at the sequence below, it appears the debug load is interrupted.

If I try a non-debug load, I get this - but from the above we can see the DAP device.

Open On-Chip Debugger 0.10.0+dev-3.0.0.665 (2020-03-20-10:13)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.org/doc/doxygen/bugs.html

Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.

adapter speed: 2000 kHz

** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

cortex_m reset_config sysresetreq

cortex_m reset_config sysresetreq

Info : Using CMSIS loader 'CY8C6xxx_SMIF' for bank 'psoc6_smif0_cm0' (footprint 6485 bytes)

Warn : SFlash programming allowed for regions: USER, TOC, KEY

Error: unable to find CMSIS-DAP device

Error: No Valid JTAG Interface Configured.

3: if I power cycle the board, I get the blinky LED. Then, if I then download the normal (non-debug) version, it says it is erasing and downloading the code. However, I then get this:

Error: CMSIS-DAP command CMD_DISCONNECT failed.

Error: error writing data: LIBUSB_ERROR_IO

Error: CMSIS-DAP command CMD_CONNECT failed.

Error: error writing data: LIBUSB_ERROR_IO

Polling target psoc6.cpu.cm4 failed, trying to reexamine

Error: error writing data: LIBUSB_ERROR_IO

Error: CMSIS-DAP command CMD_DISCONNECT failed.

Error: error writing data: LIBUSB_ERROR_IO

Error: CMSIS-DAP command CMD_CONNECT failed.

Error: error writing data: LIBUSB_ERROR_IO

(etc)

and the blinky happens.

4. I keep getting "Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around"

- I have not been able to find the "OpenOCD manual work-around"

- I did find a github example. I added it to main.c:

/* https://github.com/arduino/OpenOCD/blob/master/contrib/rtos-helpers/FreeRTOS-openocd.c

* Since at least FreeRTOS V7.5.3 uxTopUsedPriority is no longer

* present in the kernel, so it has to be supplied by other means for

* OpenOCD's threads awareness.

*

* Add this file to your project, and, if you're using --gc-sections,

* ``--undefined=uxTopUsedPriority'' (or

* ``-Wl,--undefined=uxTopUsedPriority'' when using gcc for final

* linking) to your LDFLAGS; same with all the other symbols you need.

*/

#include "FreeRTOSConfig.h"

#include "FreeRTOS.h"

#ifdef __GNUC__

#define USED __attribute__((used))

#else

#define USED

#endif

const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1;

-----------------------------------------------------------------------------------

FreeRTOS.h:

// const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1;

extern const int USED uxTopUsedPriority;

-----------------------------------------------------------------------------------

5. I am also getting it at execution time, on memory accesses for invocations like:

list.h: #define listCURRENT_LIST_LENGTH( pxlist )  ((pxlist) -> uxNumberOfItems)

6. They also occur at the start of the Debug sequence:

Started by GNU MCU Eclipse

Open On-Chip Debugger 0.10.0+dev-3.0.0.665 (2020-03-20-10:13)

Licensed under GNU GPL v2

For bug reports, read

    http://openocd.org/doc/doxygen/bugs.html

Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.

adapter speed: 2000 kHz

** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

cortex_m reset_config sysresetreq

cortex_m reset_config sysresetreq

Info : Using CMSIS loader 'CY8C6xxx_SMIF' for bank 'psoc6_smif0_cm0' (footprint 6485 bytes)

Warn : SFlash programming allowed for regions: USER, TOC, KEY

Info : CMSIS-DAP: SWD  Supported

Info : CMSIS-DAP: FW Version = 2.0.0

Info : CMSIS-DAP: Interface Initialised (SWD)

Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1

Info : CMSIS-DAP: Interface ready

Info : KitProg3: FW version: 2.0.809

Info : KitProg3: Pipelined transfers enabled

Info : VTarget = 3.298 V

Info : kitprog3: acquiring PSoC device...

Info : clock speed 2000 kHz

Info : SWD DPIDR 0x6ba02477

Info : psoc6.cpu.cm0: hardware has 4 breakpoints, 2 watchpoints

Info : psoc6.cpu.cm0: external reset detected

***************************************

** Silicon: 0xE206, Family: 0x100, Rev.: 0x23 (B2)

** Detected Device: CY8C6247BZI-D54

** Detected Main Flash size, kb: 1024

** Flash Boot version: 1.20.1.42

** Chip Protection: NORMAL

***************************************

Info : psoc6.cpu.cm4: hardware has 6 breakpoints, 4 watchpoints

Info : psoc6.cpu.cm4: external reset detected

Info : Listening on port 3332 for gdb connections

Info : Listening on port 3333 for gdb connections

Info : kitprog3: acquiring PSoC device...

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x00001f34 msp: 0x080477a8

** Device acquired successfully

** psoc6.cpu.cm4: Ran after reset and before halt...

target halted due to debug-request, current mode: Thread

xPSR: 0x61000000 pc: 0x1600400c msp: 00000000

Started by GNU MCU Eclipse

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : accepting 'gdb' connection on tcp/3333

Info : New GDB Connection: 1, Target psoc6.cpu.cm4, state: halted

semihosting is enabled

Info : Auto-detected RTOS: FreeRTOS

Error: FreeRTOS: uxTopUsedPriority is not defined, Info : Auto-detected RTOS: FreeRTOS

consult the OpenOCD manual for a work-around

Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around

Info : All data matches, Flash programming skipped

target halted due to debug-request, current mode: Thread

xPSR: 0x61000000 pc: 0x10006720 psp: 0x08002e18, semihosting

Info : psoc6.cpu.cm4: bkpt @0x100022D1, issuing SYSRESETREQ

Info : psoc6.cpu.cm4: external reset detected

Info : psoc6.cpu.cm4: external reset detected

target halted due to debug-request, current mode: Thread

xPSR: 0x61000000 pc: 0x100022d0 msp: 0x08047800, semihosting

Info : psoc6.cpu.cm0: external reset detected

===== arm v7m registers

(0) r0 (/32): 0x40210400

(1) r1 (/32): 0x0000000E

(2) r2 (/32): 0x402102C0

(3) r3 (/32): 0x10002000

(4) r4 (/32): 0x100022D1

(5) r5 (/32): 0xA5A5A5A5

(6) r6 (/32): 0xA5A5A5A5

(7) r7 (/32): 0xA5A5A5A5

(8) r8 (/32): 0xA5A5A5A5

(9) r9 (/32): 0xA5A5A5A5

(10) r10 (/32): 0xA5A5A5A5

(11) r11 (/32): 0xA5A5A5A5

(12) r12 (/32): 0xA5A5A5A5

(13) sp (/32): 0x08047800

(14) lr (/32): 0xFFFFFFFF

(15) pc (/32): 0x100022D0

(16) xPSR (/32): 0x61000000

(17) msp (/32): 0x08047800

(18) psp (/32): 0x08002E18

(20) primask (/1): 0x00

(21) basepri (/8): 0x00

(22) faultmask (/1): 0x00

(23) control (/2): 0x00

(24) d0 (/64): 0xAD4733522FB7DD13

(25) d1 (/64): 0x9B61C908FFED6812

(26) d2 (/64): 0x3F16F41EF93D7114

(27) d3 (/64): 0x7D667914FDD17815

(28) d4 (/64): 0xF5E7F8109F7291B3

(29) d5 (/64): 0xFF776B80B9F57916

(30) d6 (/64): 0xE4777914EB558916

(31) d7 (/64): 0x05F5E1004CBEBC20

(32) d8 (/64): 0xF637F853FBA5B992

(33) d9 (/64): 0xFF77D412B37FA11C

(34) d10 (/64): 0xB9AFF59A5597F442

(35) d11 (/64): 0xBBE77992D9FF7A55

(36) d12 (/64): 0x5F27713AFEB6F0D0

(37) d13 (/64): 0xBF5E3D83FF5A5886

(38) d14 (/64): 0x577CF081FF37C040

(39) d15 (/64): 0xFABFD12A79793390

(40) fpscr (/32): 0x00000000

===== Cortex-M DWT registers

===== Cortex-M DWT registers

Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello baga_4725781

1. Regarding the first issue mentioned by you, we tried running the blinky code example on the kit, then did an erase and programmed the normal version of the USB_CDC_Echo project provided by you. We have noticed that the LED no longer blinked and the USB CDC Echo project was working properly. Please ensure that while debugging you do not put a breakpoint before the device is completely enumerated.

2. Regarding the "Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around" that you are getting please refer to the following link for the workaround and explaination: https://repo.or.cz/openocd.git/blob/HEAD:/contrib/rtos-helpers/FreeRTOS-openocd.c

Corresponding bug opened against FreeRTOS is here: https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/33

3.Error: CMSIS-DAP command CMD_DISCONNECT failed.

   Error: error writing data: LIBUSB_ERROR_IO

The above error generally occurs when there are issues with USB connectivity. We recommend to change the USB cable or plug it to different USB port.

Best Regards

Ekta

View solution in original post

0 Likes
Reply
10 Replies
New Contributor II

I got the latest version on github.

In the build window, lower-left corner, just under "new Application" is "Search Online".

I found GitHub - cypresssemiconductorco/mtb-example-psoc6-usb-cdc-echo: This example demonstrates how to con...

What is not clear is how you load the new project into Modus Toolkit.

I unzipped the file in the same directory as other projects and it seemed to work, but it is obscure.

I did it yesterday and got things to work

Today, I went back to do more work && Modus complained about not finding the .project file - which was in the directory.

I had to recreate it - took editing the .launch files to point to the right .elf and .hex files.

0 Likes
Reply
Moderator
Moderator

Hello baga_4725781

Please refer to Modus Quick Start Guide for the steps to Import Code example into Modustoolbox IDE: https://www.cypress.com/file/504366/download

1. As per my understanding you are referring to the USB CDC Echo CE by USBFS_UART project. Can you please confirm? Please provide the hex files of both the projects Blinky and the USB project that you are using so that we can perform the same steps and confirm if we also see the same.

2. The error :

Error: unable to find CMSIS-DAP device

Error: No Valid JTAG Interface Configured.

Generally occurs when the connection is not proper. I tried programming my board without connecting the USB cable and got the following error:

Open On-Chip Debugger 0.10.0+dev-3.0.0.665 (2020-03-20-10:13)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.

adapter speed: 2000 kHz

** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable

cortex_m reset_config sysresetreq

cortex_m reset_config sysresetreq

Info : Using CMSIS loader 'CY8C6xxx_SMIF' for bank 'psoc6_smif0_cm0' (footprint 6485 bytes)

Warn : SFlash programming allowed for regions: USER, TOC, KEY

Error: unable to find CMSIS-DAP device

Error: No Valid JTAG Interface Configured.

Which is similar to what you had observed.

I will get back to you regarding points 3 and 5.

Best Regards

Ekta

0 Likes
Reply
New Contributor II

I have .zip files for the entire 3 projects.

If you give me an email address, I can send them to you.

(There does not appear possible to attach the .zip files to this post.)

0 Likes
Reply
Moderator
Moderator

Hello baga_4725781

In order to attach the the hex file or the project to the post please refer to the following thread: Re: How to attach a project archive file to a question?

In the reply editor box, click on Use advanced editor

pastedImage_0.png

In the Advanced Editor you can see the attach option at the bottom right

pastedImage_5.png

Browse to the location of your files and attach.

Best Regards

Ekta

0 Likes
Reply
New Contributor II

file #1

0 Likes
Reply
New Contributor II

file #2

0 Likes
Reply
New Contributor II

fle #3

0 Likes
Reply
Moderator
Moderator

Hello baga_4725781

1. Regarding the first issue mentioned by you, we tried running the blinky code example on the kit, then did an erase and programmed the normal version of the USB_CDC_Echo project provided by you. We have noticed that the LED no longer blinked and the USB CDC Echo project was working properly. Please ensure that while debugging you do not put a breakpoint before the device is completely enumerated.

2. Regarding the "Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around" that you are getting please refer to the following link for the workaround and explaination: https://repo.or.cz/openocd.git/blob/HEAD:/contrib/rtos-helpers/FreeRTOS-openocd.c

Corresponding bug opened against FreeRTOS is here: https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/33

3.Error: CMSIS-DAP command CMD_DISCONNECT failed.

   Error: error writing data: LIBUSB_ERROR_IO

The above error generally occurs when there are issues with USB connectivity. We recommend to change the USB cable or plug it to different USB port.

Best Regards

Ekta

View solution in original post

0 Likes
Reply
New Contributor II

1.. I expect the blinky to not work for the ECHO CDC - it is compltely separate code.

The fact you were able to make it works suggests pilot error on my part.

2. I looked at the link provided by a google search. I did not see your link. Thanks!

3. I used 2 new cables and tried different ports. I undersand your statement and tried them before I posted.

interesting.

Thanks! Part of the reason I posted thse issues is to help others who run into the same issues.

Yours ... bandit

0 Likes
Reply
New Contributor II

I had the USB cable connected.

I was using the USB CDC Echo CE by USBFS_UART (not sure about the "CE" part, but otherwise correct).

Thanks ...bandit

0 Likes
Reply
Top labels