# Infineon PSoC™ Troubleshooting

## *Adding the BDH Code Template*

* Open modus-shell

<figure><img src="/files/4NvOAE5KueHNkPQJXey3" alt=""><figcaption><p>modus-shell</p></figcaption></figure>

* Navigate to directory ModusToolbox and Adding the BDH code Template:

```
cd ~/.modustoolbox/
```

```
echo 'https://raw.githubusercontent.com/Advance-Innovation-Centre-AIC/mtb2-bdh-academy-manifests/master/bdh-academy-basic-app-super-manifest.xml' > ~/.modustoolbox/manifest.loc
```

<figure><img src="/files/HrEPNt1eEe86ERdNNLIh" alt=""><figcaption></figcaption></figure>

***

## *Update Firmware*

### **🖥️ For Windows**

* Open modus-shell

<figure><img src="/files/zGAJTpyYIYUPVMOaUdku" alt=""><figcaption></figcaption></figure>

> <mark style="color:orange;">ให้สังเกตชื่อไดเรกทอรี tools\_3.1 จะต้องให้ตรงกับ version ของ modusToolbox เช่น version 3.1</mark>&#x20;

* Navigate to directory ModusToolbox/tools\_3.1/fw-loader/bin/

```
$ cd ModusToolbox/tools_3.1/fw-loader/bin/
$ ./fw-loader --update-kp3
```

<figure><img src="/files/2XfqpKnVU65cBtVmLNZa" alt="" width="563"><figcaption><p>./fw-loader --update-kp3</p></figcaption></figure>

### **🖥️ For Mac**

* Checking fw’s version

<mark style="color:orange;">ให้สังเกตชื่อไดเรกทอรี tools\_3.1 จะต้องให้ตรงกับ version ของ modusToolbox เช่น version 3.2</mark>

```sh
$ cd /Applications/ModusToolbox/tools_3.2/fw-loader/bin/
$ ./fw-loader --device-list
```

```sh
Infineon Firmware Updater, Version: 3.6.0.2303
(C) Copyright 2018-2024 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start the API initialization
Info: Connected - KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069
Info: The hardware initialization has completed in 290 ms
The connected supported devices:
	1: KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069	FW Version 2.50.1383 [outdated]
Warning: The firmware on the KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069 device(s) is outdated. Use --update-kp3 [full-device-name|serial-num|all] to update.
```

ในกรณีที่มีข้อความเตือนว่า "<mark style="color:red;">is outdated</mark>" ให้ทำการอัพเดท firmware ดังรายละเอียดข้างล่างนี้

* Update firmware

```sh
$ ./fw-loader --update-kp3
```

```sh
Infineon Firmware Updater, Version: 3.6.0.2303
(C) Copyright 2018-2024 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start the API initialization
Info: Connected - KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069
Info: The hardware initialization has completed in 286 ms
Found a KitProg firmware image: "/Applications/ModusToolbox/tools_3.2/kp-firmware/kitprog3.cyacd"
Info:  The device FW is 'KitProg3' ver. 2.50 b1383.  The upgrade file is 'KitProg3' ver. 2.50 b1401.
Info: Disconnected - KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069
Info: Connected - KitProg3 Bootloader-F801020815140714
Info: Bootloader Version: Major 1, Minor 1, Build 60
Info: FW Upgrade to version: 2.50 b1401
Info: Bootloading of KitProg FW.
Info: Verifying of KitProg FW.
Info: Bootloading of DAPLink.
Info: Verifying of DAPLink.
Info: The upgrade completed.
Info: Disconnected - KitProg3 Bootloader-F801020815140714
Info: Connected - KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069
The firmware update has completed successfully.
```

> ในกรณีที่โหมดการเขียนโปรแกรมยังเป็น "<mark style="color:red;">`KitProg3 DAPLink CMSIS-DAP`</mark>" ให้เปลี่ยนโหมดการเขียนโปรแกรมให้เป็น "<mark style="color:green;">`KitProg3 CMSIS-DAP BULK`</mark>" ดังคำสั่งนี้

```sh
./fw-loader --mode kp3-bulk      
                                                                                                             ─╯
Infineon Firmware Updater, Version: 3.6.0.2303
(C) Copyright 2018-2024 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start the API initialization
Info: Connected - KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069
Info: The hardware initialization has completed in 292 ms
Info: Disconnected - KitProg3 DAPLink CMSIS-DAP-190B1301f808151401f8081500000000000000002e127069
Info: Connected - KitProg3 CMSIS-DAP BULK-141508F801071400
The mode switching completed successfully.
```

***

## *<mark style="background-color:blue;">Bug #001 : Switching mode DAPLink to KitProg3 or KitProg3 to DAPLink mo</mark>*<mark style="background-color:blue;">de</mark>&#x20;

### Bug issue

{% hint style="info" %} <mark style="color:red;">Error: It looks like your debug probe is in DAPLink mode. Please switch to KitProg3 mode or use CMSIS-DAP driver instead.</mark>
{% endhint %}

<figure><img src="/files/mTyuKExxUxOsYfeV2XbR" alt=""><figcaption><p>Error alert when launching the Application</p></figcaption></figure>

### How to Fix

<figure><img src="/files/x6MqOVS7vQhNKk3fnWKM" alt=""><figcaption><p><a href="https://www.infineon.com/dgdl/Infineon-KitProg3_User_Guide-UserManual-v17_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0f01221f1853">Mode Switching</a></p></figcaption></figure>

<figure><img src="/files/l57phr5k9nc0LrI5RkPN" alt="" width="360"><figcaption><p>Button for Switching mode</p></figcaption></figure>

{% hint style="info" %} <mark style="color:red;">In case pressing the switch button doesn't yield any response, you may need to first update the firmware. Follow the steps below:</mark>
{% endhint %}

1. Open the Modus shell.
2. Navigate to the necessary directory by entering the following command:

```shell-session
$ cd ModusToolbox/tools_3.1/fw-loader/bin/
```

3. Update the firmware by executing the command:

```shell-session
$ ./fw-loader --update-kp3
```

4. After updating the firmware, verify the available devices with the command:

```shell-session
$ ./fw-loader --device-list
```

Once the firmware is updated, you should be able to use the switch mode button successfully.

***

## *<mark style="background-color:purple;">Bug #002 : "Error: IMU init failed (0x0000)!" message</mark>*

### Bug issues&#x20;

<figure><img src="/files/wyzTDTaLv2e4VTr1Nedx" alt=""><figcaption></figcaption></figure>

### How to Fix

Find <mark style="color:red;">**mtb\_shared**</mark> folder in your project and change the <mark style="color:red;">**BMI160\_CHIP\_IP**</mark>&#x20;

<figure><img src="/files/fCHndJO2ONhJ2fXwcOaC" alt=""><figcaption><p>bmi160_defs.h</p></figcaption></figure>

***

## Firmware update&#x20;

* Update firmware:

```
$  cd ~/ModusToolbox/tools_3.1/fw-loader/bin
$  ./fw-loader --update-kp3
$  ./fw-loader --device-list
```

***

## *Bug#003 Can't install edge-impulse-cli*

<figure><img src="/files/CIJzt3e8cZBIh3mDERuW" alt=""><figcaption><p>Visual Studio installer error.</p></figcaption></figure>

### How to fix:

#### 1. Install Visual Studio Installer

* [Visual Studio Installer link](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community\&channel=Release\&version=VS2022\&source=VSLandingPage\&cid=2030\&passive=false)

<figure><img src="/files/lkqqUqLkrfH4Mn3ZSmk5" alt=""><figcaption><p>Installation</p></figcaption></figure>

<figure><img src="/files/wTHSt8uKF7JgQ3ZFBaBv" alt=""><figcaption><p>Open and select "<strong>Desktop development with C++</strong>" then install</p></figcaption></figure>

<figure><img src="/files/KZi9ax4HHD0dqRS8mhIX" alt=""><figcaption><p>Install complect</p></figcaption></figure>

{% hint style="info" %}
Important: You need to use python3.11.x
{% endhint %}

Install edge-impulse-cli again:

```
npm install -g edge-impulse-cli --force
```

<figure><img src="/files/Uofne5DBFLWNpicZYoy1" alt=""><figcaption><p>Sucessfully install the edge-impulse-cli</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aic-eec.com/biil_psoc6/infineon-psoc-tm-troubleshooting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
