PSoC™ 6 Forum Discussions
Hi guys,
I am fairly new with psoc and modustoolbox, but i am having trouble debugging applications.
I am using the 'Wi-Fi Web Server' Application at the minute and keep getting the same error when debugging the application. It seems to be happening for all Bluetooth and Wi-Fi applications.
The errors can be seen below, any help would be greatly appreciated, thanks!
Show Less
After programming the mcuboot hex file using
make clean app APP_NAME=MCUBootApp PLATFORM=PSOC_062_1M FLASH_MAP=./psoc62_1m_cm0_int_swap_single.json
I got the boot loader progarmmed successfully, and got the UART message as follow
[INF] MCUBoot Bootloader Started
[DBG] * boot_prepare_image_for_update...
[DBG] > boot_prepare_image_for_update: image = 0
[DBG] * Read an image (0) header from each slot: rc = 0
[DBG] * selected SCRATCH area, copy_done = 3
[INF] Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Boot source: primary slot
[DBG] > STATUS: swap_read_status_bytes: fa_id = 1
[DBG] * re-read image(0) headers: rc = 0.
[DBG] * There was no partial swap, determine swap type.
[INF] boot_swap_type_multi: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] boot_swap_type_multi: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Swap type: none
[DBG] > boot_validate_slot: fa_id = 1
[ERR] Image in the primary slot is not valid!
[DBG] < boot_validate_slot = 1
[DBG] > boot_validate_slot: fa_id = 2
[DBG] * Fix the secondary slot when image is invalid.
[DBG] * Erase secondary image trailer.
[INF] Erasing trailer; fa_id=2
[DBG] * No bootable image in slot(1); continue booting from the primary slot.
[DBG] < boot_validate_slot = 1
[DBG] < boot_prepare_image_for_update
[DBG] * process swap_type = 1
[DBG] > boot_validate_slot: fa_id = 1
[ERR] Image in the primary slot is not valid!
[DBG] < boot_validate_slot = 1
[ERR] MCUBoot Bootloader found none of bootable images
but when I try to Program the board using Program (KitProg3) I got this error
Started by GNU MCU Eclipse
Open On-Chip Debugger 0.11.0+dev-4.4.0.2134 (2022-09-08-13:07)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
kitprog3 set_latest_version: C:/Users/owaf/ModusToolbox/tools_3.0/fw-loader 2.40.1241
adapter speed: 2000 kHz
adapter srst delay: 25
adapter srst pulse_width: 25
** Auto-acquire enabled, use "set ENABLE_ACQUIRE 0" to disable
cortex_m reset_config sysresetreq
cortex_m reset_config sysresetreq
Info : Using CMSIS-flash algorithms 'CY8C6xxx_SMIF' for bank 'psoc6_smif0_cm0' (footprint 17032 bytes)
Info : CMSIS-flash: ELF path: ../flm/cypress/cat1a/CY8C6xxx_SMIF.FLM
Info : CMSIS-flash: Address range: 0x18000000-0x1FFFFFFF
Info : CMSIS-flash: Program page size: 0x00001000 bytes
Info : CMSIS-flash: Erase sector size: 0x00040000 bytes, unified
Warn : SFlash programming allowed for regions: USER, TOC, KEY
Info : Using CMSIS-DAPv2 interface with VID:PID=0x04b4:0xf155, serial=061F02F302098400
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands 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.40.1241
Info : KitProg3: Pipelined transfers enabled
Info : KitProg3: Asynchronous USB transfers enabled
Info : VTarget = 3.274 V
Info : kitprog3: acquiring the device (mode: reset)...
Error: kitprog3: failed to acquire the device
Info : clock speed 2000 kHz
Error: Error connecting DP: cannot read IDR
Error: Error connecting DP: cannot read IDR
Error: Error connecting DP: cannot read IDR
Error: DAP 'psoc6.cpu' initialization failed (check connection, power, transport, DAP is enabled etc.)
Info : psoc6.dap: powering down debug domain...
Error: Error connecting DP: cannot read IDR
Error: Error connecting DP: cannot read IDR
Warn : Failed to power down Debug Domains
Show Less
I'm new to the ModusToolbox and I have to say that I like it. I started playing with examples running the SAR ADC and it works when using the example from Github (hal adc basic).
However, this example doesn't use the Device Configurator. Could someone explain to me why that is?
Anyway, I tried to create a SAR example by using the Device Configurator and everything works up to starting the conversion but the provided values aren't correct.
What I did is the following:
- Enabling SAR
- Vref set to Vdda
- Number of channels set to 1
- Assigned a random clock
- Single ended result set to unsigned
- Set Ch0 Vplus to 10_0
In the main.c the following was added:
cycfg_config_init(); //to initialize everything done in the device configurator
int16_t result1;
float32_t resultV_0 = 0;
if (CY_SAR_SUCCESS != Cy_SAR_Init(SAR, &pass_0_sar_0_config))
{
printf("Error initializing SAR\r\n");
CY_ASSERT(0);
}
Cy_SAR_Enable(SAR);
Cy_SAR_StartConvert(SAR, CY_SAR_START_CONVERT_CONTINUOUS);
for(;;){
result1 = Cy_SAR_GetResult16(SAR, 0);
resultV_0 = Cy_SAR_CountsTo_Volts(SAR, 0, result1);
printf("%.2fV \r\n", resultV_0);
}
Did I miss something obvious?
I added the example project as zip file, it is the hello world example with the above code added.
Show LessHello,
I am trying to build HelloWorld example with CY8CPROTO-064S1-SB board with MTB 3.0.
This is the error message I got. Please advice. Thanks.
Traceback (most recent call last):
File "C:/Users/XXXXXXXX/mtw3/Hello_World/bsps/TARGET_APP_CY8CPROTO-064S1-SB/psoc64_postbuild.py", line 281, in <module>
main(sys.argv[1:])
File "C:/Users/XXXXXXXX/mtw3/Hello_World/bsps/TARGET_APP_CY8CPROTO-064S1-SB/psoc64_postbuild.py", line 253, in main
tools.sign_image(app_hex_path,1)
File "C:\Users\XXXXXXXX\ModusToolbox\tools_3.0\python\lib\site-packages\cysecuretools\main.py", line 268, in sign_image
if not self._validate_policy(['pre_build', 'dap_disabling']):
File "C:\Users\XXXXXXXX\ModusToolbox\tools_3.0\python\lib\site-packages\cysecuretools\main.py", line 915, in _validate_policy
raise ValueError(f"Cannot find policy file '{self.policy}'")
ValueError: Cannot find policy file 'C:\Users\XXXXXXXX\mtw3\Hello_World\policy\policy_single_CM0_CM4.json'
make[1]: *** [../mtb_shared/core-make/release-v3.0.3/make/core/bwc.mk:155: _mtb_build__legacy_bsp_postbuild] Error 1
make: *** [../mtb_shared/core-make/release-v3.0.3/make/core/main.mk:376: secondstage_build] Error 2
"C:/Users/XXXXXXXX/ModusToolbox/tools_3.0/modus-shell/bin/make CY_MAKE_IDE=eclipse CY_IDE_TOOLS_DIR=C:/Users/XXXXXXXX/ModusToolbox/tools_3.0 CY_IDE_BT_TOOLS_DIR= -j8 all" terminated with exit code 2. Build might be incomplete.
16:37:45 Build Failed. 2 errors, 0 warnings. (took 1m:5s.905ms)
Show LessHi,
I am working on one appliance where I am using the CY8CKIT43012 MCU. My requirement is to read high frequency data by using the SAR ADC.
As of now I am using Mods-toolbox V3.0, HAL version 2.0 and I am reading the 5000 sample by using ADC asynchronous mode.
ADC channel configuration:
/** Default ADC configuration */
const cyhal_adc_config_t adc_config_current_obj = {
.continuous_scanning=false, // Continuous Scanning is disabled
.average_count=1, // Average count disabled
.average_mode_flags=false,
.vref=CYHAL_ADC_REF_VDDA, // VREF for Single ended channel set to VDDA
.vneg=CYHAL_ADC_VNEG_VSSA, // VNEG for Single ended channel set to VSSA
.resolution = 12u, // 12-bit resolution
.ext_vref = NC, // No connection
.bypass_pin = NC // No connection
};
/* ADC channel configuration */
const cyhal_adc_channel_config_t channel_config_current_obj = {
.enable_averaging = false, // Disable averaging for channel
.min_acquisition_ns = 167, // Minimum acquisition time set to167 ns
.enabled = true // Sample this channel when ADC performs a scan
};
I am reading the single ADC channel and I have set the sample rate as 1MSPS. And I am getting actual sample rate as 997008 Hz.
The input voltage range is 0 to 3.3V. Whenever I have read <10kHz frequency then I am getting the correct data. But once I increase the input frequency lets say 20kHz or 40 kHz then I am not getting correct output.
So I want to confirm that Is it possible to read >20 kHz frequency in the MCU by using ADC?
Show Less
I am using the SendKeystroke() that I copied from the hids.c in the CY8CPROTO-063 demo board.
The keys keep sticking, not because the switch is stuck but because the BLE HID Report requires you to send a keyup request with keyboard_data = {0,0,0,0,0,0,0,0}. That Send runs into a CyBle_GattGetBusyStatus() == 0x1, so the keyup Report doesn't get sent and the Repeat Delay on the keyboard setting somewhere times out as if the key is stuck in the down position.
This event `CY_BLE_EVT_STACK_BUSY_STATUS` occurs in the keyupRequest and causes a `CY_BLE_ERROR_INVALID_OPERATION` error in the keyupRequest, the request after:
keyboard_data[2u] = 0u;
keyboard_data[3u] = 0u;
I've tried checking CyBle_GattGetBusyStatus() again, before sending keyUpRequest and adding a delay with exponential backup. That doesn't seem to work. The CyBle_GattGetBusyStatus() just returns a busy status for up to six seconds, even though I can send consecutive keystrokes much faster.
Is there a way to ensure the keyupRequest is always sent?
Is there a way to set the keyboard repeat-delay setting to a maximum value in the Keyboard characteristics? My keyboard will never need the hold-down repeat function.
I put example code here: https://github.com/InTEGr8or/ble_hid_416045_public
if((Cy_BLE_GATT_GetBusyStatus(connHandle.attId) == CY_BLE_STACK_STATE_FREE) &&
(--keyboardTimer == 0u) && (keyboardSimulation == true))
//(--keyboardTimer == 0u) && ((keyboardSimulation & (ENABLED << connHandle.attId)) != 0u))
{
keyboardTimer = KEYBOARD_TIMEOUT;
simKey++;
if(simKey > SIM_KEY_MAX)
{
simKey = SIM_KEY_MIN;
}
keyboard_data[3u] = simKey;
apiResult = Cy_BLE_HIDSS_GetCharacteristicValue(CY_BLE_HUMAN_INTERFACE_DEVICE_SERVICE_INDEX,
CY_BLE_HIDS_PROTOCOL_MODE, sizeof(protocol), &protocol);
if(apiResult == CY_BLE_SUCCESS)
{
DBG_PRINTF("%sHID notification: ", LINECHR);
for(i = 0; i < KEYBOARD_DATA_SIZE; i++)
{
DBG_PRINTF("%2.2X", keyboard_data[i]);
if(i < KEYBOARD_DATA_SIZE - 1) DBG_PRINTF("-");
}
DBG_PRINTF("%s", CHRTN);
if(protocol == CY_BLE_HIDS_PROTOCOL_MODE_BOOT)
{
apiResult = Cy_BLE_HIDSS_SendNotification(connHandle, CY_BLE_HUMAN_INTERFACE_DEVICE_SERVICE_INDEX,
CY_BLE_HIDS_BOOT_KYBRD_IN_REP, KEYBOARD_DATA_SIZE,
keyboard_data);
}
else
{
apiResult = Cy_BLE_HIDSS_SendNotification(connHandle, CY_BLE_HUMAN_INTERFACE_DEVICE_SERVICE_INDEX,
CY_BLE_HUMAN_INTERFACE_DEVICE_REPORT_IN, KEYBOARD_DATA_SIZE,
keyboard_data);
}
if(apiResult == CY_BLE_SUCCESS)
{
keyboard_data[2u] = 0u; /* Set up keyboard data */
keyboard_data[3u] = 0u; /* Set up keyboard data */
if(protocol == CY_BLE_HIDS_PROTOCOL_MODE_BOOT)
{
apiResult = Cy_BLE_HIDSS_SendNotification(connHandle, CY_BLE_HUMAN_INTERFACE_DEVICE_SERVICE_INDEX,
CY_BLE_HIDS_BOOT_KYBRD_IN_REP, KEYBOARD_DATA_SIZE,
keyboard_data);
}
else
{
apiResult = Cy_BLE_HIDSS_SendNotification(connHandle, CY_BLE_HUMAN_INTERFACE_DEVICE_SERVICE_INDEX,
CY_BLE_HUMAN_INTERFACE_DEVICE_REPORT_IN, KEYBOARD_DATA_SIZE,
keyboard_data);
}
}
if(apiResult != CY_BLE_SUCCESS)
{
DBG_PRINTF_LINE("HID notification API Error: 0x%X ", apiResult);
}
}
Cy_BLE_ProcessEvents();
}
Show Less
Hello,
I am using CY8CKIT-062-WIFI-BT with CY8CKIT-028-TFT Shield and I want to print something on the screen. I added the emwin and display-tft libraries (1. png) and included them in the main.c file , but when I try to build the project I am getting the following error (even if the file exists):
../mtb_shared/emwin/release-v6.24.0/GUI/Include/GUI_ConfDefaults.h:54:10: fatal error: GUIConf.h: No such file or directory
Any clue about how can i solve this issue?
Show LessHello everyone,
I am currently in need of a 30-channel ADC with a 1 MSps sampling rate for my application. While I am willing to decrease the samples per second slightly, I would prefer to have it operate at 1 MSps. I came across an article (https://www.embedded.com/sampling-a-16-channel-sar-with-an-8-channel-programmable-soc/?unapproved=75...) that sparked my interest.
Since the availability of the 1x SAR PSoC6 is better than the 2x SAR PSoC6, I am curious whether following the example in the article would result in the 30-channel ADC that I require. However, as a newcomer to the PSoC family, I would appreciate any input as I am unable to try this on my own.
I have examined the demo board CY8CPROTO-063-BLE, which utilizes the CY8C6347BZI-BLD53 and has the necessary universal data blocks (UDBs) as well as 1x SAR.
Any feedback would be greatly appreciated.
Show LessHi all,
I am using PSoC62S2 with CY8CKIT-028-TFT shield. There is a feature called ambient light sensor on the CY8CKIT-028-TFT board, and I would like to use it. I found this repository https://github.com/Infineon/sensor-light#quick-start , but the code inside it does not work in my case. I keep getting "Info : dropped 'gdb' connection" and "Break at address "0x190" with no debug information available, or outside of program code.". I am using "Run KitProg3_MiniProg4". I guess there is something wrong with the light sensor pin since it only printed out "start" and "enter loop". Does anyone know which pin should I use?
Here is my current code:
#include "cyhal.h"
#include "cybsp.h"
#include "mtb_light_sensor.h"
#include "cy_retarget_io.h"
#define LIGHT_SENSOR_PIN (CYBSP_A0)
cyhal_adc_t adc;
mtb_light_sensor_t light_sensor;
int main(void)
{
cy_rslt_t rslt;
rslt = cybsp_init();
CY_ASSERT(rslt == CY_RSLT_SUCCESS);
rslt = cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX,
CY_RETARGET_IO_BAUDRATE);
CY_ASSERT(rslt == CY_RSLT_SUCCESS);
rslt = cyhal_adc_init(&adc, LIGHT_SENSOR_PIN, NULL);
CY_ASSERT(rslt == CY_RSLT_SUCCESS);
rslt = mtb_light_sensor_init(&light_sensor, &adc, LIGHT_SENSOR_PIN);
CY_ASSERT(rslt == CY_RSLT_SUCCESS);
printf("start\n");
for(;;) {
printf("enter loop\n");
uint8_t light = mtb_light_sensor_light_level(&light_sensor);
printf("light level: %d\n",light);
cyhal_system_delay_ms(1000);
}
}
Thanks a lot!
Show Less