Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Andyjety
Level 3
Level 3
First solution authored 25 sign-ins 10 replies posted

Hi 
I am studying the Device Firmware Upgrade code
I can change the code and make it run the FW upgrade via UART by modifying the common.mk, 

and I noted the differences when I used the original sample with the I2C interface, when the upgrade process is done, the PSoC6 cam restart/reboot. and running the cm4 code

but when I changed the interface to UART. it seems to upgrade successfully, but the EVK doesn't reboot

is there anything else I need to change besides the 

TRANSPORT_OPT?=UART

 

please advise

Thanks

 

0 Likes
1 Solution
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi ,

If upgrade successfully, the Cy_DFU_ExecuteApp will switch to the app via software reset, you can add a breakpoint here to see whether or not to execute this branch:

Ida_Wang_1-1713409268413.png

BR,

Ida

 

View solution in original post

0 Likes
17 Replies
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi ,

If upgrade successfully, the Cy_DFU_ExecuteApp will switch to the app via software reset, you can add a breakpoint here to see whether or not to execute this branch:

Ida_Wang_1-1713409268413.png

BR,

Ida

 

0 Likes

Hi Ida

it seems fixed if I load the completed new code example and change the transport_opt to UART

but I face another issue, I can't switch the chip to CY8C6244 AZI-S4D62
is there an example code or guideline to guide me on how to implement the DFU besides the example code "Basic_Device_Firmware_Upgrade"
my real product is designed with CY8C6244AZI-S4D62

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi   ,

You can refer to :

https://bbs.21ic.com/icview-3357938-1-1.html

It guides you how to change the device type by ModusToolbox.

BR,

Ida

0 Likes

Hi Ida

I tried to follow the instructions on the URL you introduced
but I still get errors and seems the Device Configurator would like me to switch back to the original chip

below is the error information

Auto-discovery in progress...

# 0: Code generator 'device-configurator-cli' finished - FAILED

ERROR:[INFO] Log file= "/private/var/folders/9w/pqkzgfh949gfq_p52stm3z9m0000gn/T/device-configurator-cli/device-configurator-cli-20240422.104810.281-73092.log"

ERROR:[INFO] Command line= "/Applications/ModusToolbox/tools_3.2/device-configurator/device-configurator.app/Contents/MacOS/device-configurator-cli --build /Users/andyjery/mtw1/Basic_Device_Firmware_Upgrade/bsps/TARGET_APP_CY8CKIT-062S4/config/design.modus --readonly"

ERROR:[INFO] Server log file= "/private/var/folders/9w/pqkzgfh949gfq_p52stm3z9m0000gn/T/hardware-config-server/hardware-config-server-20240422.104623.604-73025.log"

ERROR:[INFO] Opened file= "/Users/andyjery/mtw1/Basic_Device_Firmware_Upgrade/bsps/TARGET_APP_CY8CKIT-062S4/config/design.modus"

ERROR:[INFO] Libraries= "[Default] /Users/andyjery/.modustoolbox/global/device-db/release-v4.14.0/props.json,/Users/andyjery/mtw1/mtb_shared/mtb-pdl-cat1/release-v3.10.0/props.json"

ERROR: Code generation errors:

ERROR: - Errors exist in the project's configuration:

ERROR: There may be an inconsistency between the *.modus file and the makefile target configuration device sets.

ERROR:Current Devices: CY8C6244AZI-S4D62

ERROR:Expected Devices: CY8C6244LQI-S4D92

make: *** [/Users/andyjery/mtw1/Basic_Device_Firmware_Upgrade/bootloader_cm0p/build/I2C/APP_CY8CKIT-062S4/Debug/cyforcebuild.mk] Error 1

"/Applications/ModusToolbox/tools_3.2/modus-shell/bin/make CY_MAKE_IDE=eclipse CY_IDE_TOOLS_DIR=/Applications/ModusToolbox/tools_3.2 CY_IDE_BT_TOOLS_DIR= -j12 all" terminated with exit code 2. Build might be incomplete.

Andyjety_0-1713755084971.png

 

0 Likes
lock attach
Attachments are accessible only for community members.
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi,

I have generated a DFU example for CY8C6244 AZI-S4D62, you can refer to the attachment. 

The transition steps are:

1. Open the "Device Configurator": disable the usb device; choose "None" for IMO's "Trim with" configuration.

2. Delete "design.cyusbdev" in path "bsps/TARGET_APP_CY8KIT-062S4"

delete "cycfg_usbdev.c","cycfg_usbdev.h" and "cycfg_usbdev.timestamp" in path "bsps/TARGET_APP_CY8KIT-062S4/config"

3. Open "BSP Assistant", change the device to "CY8C6244 AZI-S4D62", click "Save"

4. Open "Device Configurator", fix the errors it recommends 

BR,

Ida

 

0 Likes

Hi Ida

I followed your steps, it seems to fix the problem
but there are a couple of items that are different from what you mentioned
the files you want me to delete, I couldn't find them in my folders
in the final step, in the device configurator, the message asks me to switch to S4D92, once I switch to S4D92, then the message asks me to switch back S4D62
I have to switch to and back. Then I can get the compiler successfully

it seems to be fixed anyway, thanks 

0 Likes
lock attach
Attachments are accessible only for community members.

Hi Ida

another issue with this example code
I am preparing to implement my code into the DFU 
so, I tried the printf of retarget_io first
it seems once I use this function, the main code- blinky_cm4 is not working, and can't switch back to bootloader mode

because the UART is also my main communication channel to my another product
and printf is also the way to print debug message and JSON data

please advise

Thanks

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi,

1. Where did you initialize the retarget-io?

2. Confirm that the pins used for DFU_UART don't conflict with pins used for retarget-io

BR,

Ida

0 Likes

Hi Ida

library manager 2.2

Can I use the same pins?

As I said, I just have one UART to USB port to do the communication with the host machine
and I need the same port to do the Firmware Upgrade by the host machine

Thanks

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi,

1. If you want to use printf, you should initialize the retarget-io by calling "cy_retarget_io_init",  you can create a "Hello world" example to see how to use it.

2. For the DFU example, if you choose UART as communication port, you should have a dedicated port for updating firmware. The device will send some response packets to host when updating:

Ida_Wang_0-1713937998430.png

So from my understanding, it's not recommended to use the same port for upgrading and printing.

BR,

Ida

0 Likes

Hi Ida

if I don't the printf function on UART port when bootloader mode

is it ok?

Thanks

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi,

1. If you want to print messages using the same uart port, I think you should print messages before Cy_DFU_Continue and after Cy_DFU_TransportStart. Because Cy_DFU_TransportStart is used to initialize the uart, and Cy_DFU_Continue  is used to handle the upgrading command.

2. You should not initialize the uart by cy_retarget_io_init , because it is initialized by Cy_DFU_TransportStart . Also you can try the function "Cy_SCB_UART_PutArrayBlocking(CY_DFU_UART_HW, (void*)pData, size);" to print message instead of "printf".

That's my opinion. You can try, but still not recommend this method.

BR,

Ida

0 Likes

Hi Ida
it doesn't work,

the compiler is passed, but when I program it, the bsp initials the bootloader mode at the beginning, I used the DFU tool to program the blinky_cm4_crc.cyacd2.
once the programming is done, the bsp hangs.
I have to erase the flash in order to reprogram the bootloader

any other methods that can achieve my application?

 

Thanks

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Hi,

I add below code to print message, it worked.

Ida_Wang_0-1714032628660.png

Steps are:

1. Erase all the flash using cypress programmer. 

2. Program your bootloader to the device, open Tera to check the messages printed.

3. Close the Tera. Open the "DFU host tool", update the application.

4. Start up the device. Press the "User" button, check the led. It can work well.

BR,

Ida

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

Ida_Wang_1-1714032948497.png

I can switch between bootloader and application successfully with the message printed.

0 Likes

HI Ida

I guess you may have misunderstood what I meant
I would like to put strings printing function in the "application", not in the bootloader
I tried your method it did work.
but I can't duplicate it in the application code.

any advise?

Thanks

0 Likes
Ida_Wang
Moderator
Moderator
Moderator
5 likes given 100 sign-ins 100 replies posted

First of all, you should know the two cores can't use the same uart at the same time.

You can use IPC for two core communication. If one core want to use this uart, it asks the other core to deinit the uart. After gets the reply, it can init the uart and use it.

About how to use IPC, you can create related IPC code example.

Again, I don't advise you to use the same uart for upgrading and printing , especially in two different cores. It requires a high level knowledge of the device peripherals and logic skills.

Since we discuss many topics in this thread, it is difficult to find the solution about specific issues. I will close this thread, if you have new questions, you can create a new thread for discussion.

BR,

Ida

 

 

0 Likes