Hi,
I am testing the AnyCloud TCP Server example project for CY8CPROTO-062-4343W. Inside the tcp_receive_msg_handler(cy_socket_t socket_handle, void *arg) function (I pasted it below), I found that there was about <1s delay when calling the API cy_socket_recv(). I toggled the user LED right before and after calling this API and I found that the delay of calling this function was quite significant. The tcp_receive_msg_handler is called whenever it receives some messages from the TCP client. I tried different message lengths from the client but the delay was quite consistent.
API cy_socket_recv() should just read the buffer and I am wondering why it took that long.
I am working on an application which requires the device (uses the same PSoC6 MCU and the same Wi-Fi/BT chip) to use Wi-Fi communication and act as a TCP server. So I used the AnyCloud TCP Server example project as the basic code structure. The device needs to read something from the client and then take some action as quickly as possible. The long delay of calling cy_socket_recv() is not acceptable for my application.
Any idea how to get rid of the delay? Maybe there is another API which is better in terms of response time?
Thank you.
From AnyCloud TCP Server example project:
static cy_rslt_t tcp_receive_msg_handler(cy_socket_t socket_handle, void *arg)
{
char message_buffer[MAX_TCP_RECV_BUFFER_SIZE];
cy_rslt_t result;
/* Variable to store number of bytes received from TCP client. */
uint32_t bytes_received = 0;
cyhal_gpio_toggle(CYBSP_USER_LED);
result = cy_socket_recv(socket_handle, message_buffer, MAX_TCP_RECV_BUFFER_SIZE,
CY_SOCKET_FLAGS_NONE, &bytes_received); // Long delay when calling this
cyhal_gpio_toggle(CYBSP_USER_LED);
if(result == CY_RSLT_SUCCESS)
{
/* Terminate the received string with '\0'. */
message_buffer[bytes_received] = '\0';
printf("\r\nAcknowledgement from TCP Client: %s\n", message_buffer);
/* Set the LED state based on the acknowledgement received from the TCP client. */
if(strcmp(message_buffer, "LED ON ACK") == 0)
{
led_state = CYBSP_LED_STATE_ON;
}
else
{
led_state = CYBSP_LED_STATE_OFF;
}
}
else
{
printf("Failed to receive acknowledgement from the TCP client. Error: 0x%08"PRIx32"\n",
(uint32_t)result);
if(result == CY_RSLT_MODULE_SECURE_SOCKETS_CLOSED)
{
/* Disconnect the socket. */
cy_socket_disconnect(socket_handle, 0);
}
}
printf("===============================================================\n");
printf("Press the user button to send LED ON/OFF command to the TCP client\n");
return result;
}
I am trying to compile a C/C++ makefile project using the Eclipse IDE for ModusToolbox (Version: 2.2.0, Build ID: 2181) for CY8CKIT-062-BLE target. I am able to compile *.c and *.cpp files but *.cc files is excluded from the compilation.
If I add following in the Makefile:
SOURCES = $(wildcard extlib/*.cc)
The build console displays following error message:
../mtb_shared/core-make/latest-v1.X/make/core/build.mk:386: *** Incompatible source file type encountered while constructing explicit rule: extlib/utils.cc. Stop.
Show LessHello,
I started using modustoolbox, I decided to start with the pwm demo, because I want to control 30 pwm independently. From what I understood from the HAL interface, this interface makes it easier to use hardware modules.
I would like to know if it is possible to have a summary of the use of hardware modules by the hal library and the rest.
Best regards,
Maxime
Show LessHello,
I have installed Modus Toolbox , and uninstall and install again in different location, after installation, I try to import an object by file->new->Modus toolbox App, it come following info:
Log file(s) for this session are stored at: C:\Users\xlu\AppData\Local\Temp\Logs7924986194417700111
Unable to find ModusToolbox executables:
Unable to execute project creator command.
For the first installation, we can run this function smoothly. but after uninstall and install again it cannot run. we also try to reinstall again in the same location as the first installation, but failed. Could you please help me out
Show LessI add 2 Mesh Demo projects to Modus Toolbox IDE.Both projects use shared libraries and tools.
If i select one of the projects or an integrated file the Quick Panel is updated with information. That takes a lot of time (up to ~1 min) and blocking the IDE. Everytime i switch the project the Quick Panel is updated and blocking the whole IDE.
Is it possible to prevent an update of the quick panel? And if so, how can i prevent this?
I want to familiarize myself with the software and have to switch between the shared library header and / or the projects.
Thanks for your help
Show LessI'm working on CY8CKIT-062S2-43012.
* Create project from AnyCloud_BLE_Battery_Service.
* I'd like to change sending POT voltage as the battery level.
Add code to initialize and get ADC value.
However, execution stop at `cyhal_adc_read_u16();` It does not return value.
File `cyhal_adc.c` function `cyhal_adc_read()`, the following infinity loop does not break.
`while(!obj->adc->conversion_complete) { }`
How to use ADC?
```
int main()
{
cy_rslt_t result ;
/* Initialize the board support package */
result = cybsp_init();
if (CY_RSLT_SUCCESS != result)
{
CY_ASSERT(0);
}
/* Enable global interrupts */
__enable_irq();
/* Initialize retarget-io to use the debug UART port */
cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX, CY_RETARGET_IO_BAUDRATE);
cy_rslt_t rslt;
cyhal_adc_t adc_obj;
cyhal_adc_channel_t adc_chan_0_obj;
/* ADC conversion result. */
int32_t adc_out;
/* Initialize ADC. The ADC block which can connect to pin 10[6] is selected */
rslt = cyhal_adc_init(&adc_obj, P10_6, NULL);
/* Initialize ADC channel, allocate channel number 0 to pin 10[0] as this is the first channel initialized */
const cyhal_adc_channel_config_t channel_config = { .enable_averaging = false, .min_acquisition_ns = 220, .enabled = true };
rslt = cyhal_adc_channel_init_diff(&adc_chan_0_obj, &adc_obj, P10_6, CYHAL_ADC_VNEG, &channel_config);
/* Read the ADC conversion result for corresponding ADC channel. Repeat as necessary. */
printf("adc start\n");
adc_out = cyhal_adc_read(&adc_chan_0_obj);
printf("adc=%ld\n", adc_out);
```
```
int32_t cyhal_adc_read(const cyhal_adc_channel_t *obj)
{
uint32_t old_en_mask = 0u;
if(!obj->adc->continuous_scanning)
{
/* Enable the selected channel only, then perform an on-demand conversion.
* Save the old enabled channel set to restore after we're done */
old_en_mask = SAR_CHAN_EN(obj->adc->base);
Cy_SAR_SetChanMask(obj->adc->base, 1U << obj->channel_idx);
obj->adc->conversion_complete = false;
Cy_SAR_StartConvert(obj->adc->base, CY_SAR_START_CONVERT_SINGLE_SHOT);
}
/* Cy_SAR_IsEndConversion relies on and clears the EOS interrupt status bit.
* We don't know how this read will be used in combination with interrupts,
* so implement our own interrupt-driven EOS flag
*/
while(!obj->adc->conversion_complete) { }
int32_t result = Cy_SAR_GetResult32(obj->adc->base, obj->channel_idx);
if(!obj->adc->continuous_scanning)
{
Cy_SAR_SetChanMask(obj->adc->base, old_en_mask);
}
return result;
}
```
Show LessIs there a list of required make files or instructions on how to set CY_TOOLS_PATH?
Following Linux installation of ModusToolbox 2.2 and the 2.2.1 patch on a Ubuntu 20.10 system. Everything appears to work. The Post-Install Script run from a terminal returns "make not found".
When I open ModusToolbox IDE, all looks good until I click "New Application", which puts the following text into the Console of ModusToolbox IDE, "Unable to find tools information: Cannot run program "<my_path>/ModusToolbox/tools_2.2/modus-shell/bin/make" Is the CY_TOOLS_PATH set correctly?"
Then when attempting to create a new application, a specific make file can't be found:
Project creation command to be executed:
/home/<user_name>/ModusToolbox/tools_2.2/project-creator/bin/project-creator-cli --board-id CY8CKIT-062-WIFI-BT --board-uri https://github.com/cypresssemiconductorco/TARGET_CY8CKIT-062-WIFI-BT --board-commit latest-v2.X --app-id mtb-example-psoc6-capsense-buttons-slider-freertos --app-uri https://github.com/cypresssemiconductorco/mtb-example-psoc6-capsense-buttons-slider-freertos --app-commit latest-v2.X --user-app-name CapSense_Buttons_and_Slider_FreeRTOS --target-dir /home/<user_name>/Documents/PSoC64_A/MTBa --output-for-machine --use-modus-shell
"make -f get_tool_info.mk get_tool_info" failed: execvp: No such file or directory
Getting manifest...
Show Less
In learning the differences between the MTB and LIB flows in Modus Toolbox, I have been wondering if there is an existing hybrid approach. For example, if I have a number of projects in my workspace that use FreeRTOS, I understand the appeal of MTB flow in that I don't need to have multiple copies of FreeRTOS for each project. However, I would potentially want to have unique copies "FreeRTOSConfig.h" for each project (if they take advantage of different RTOS features and have different heap requirements for instance). It is also my understanding that updating FreeRTOS with the library manager in MTB flow would essentially eliminate all my custom settings in "FreeRTOSConfig.h" (as it would be replaced by a copy of the file from the new downloaded version). For these reasons, I would want a way to leave "FreeRTOS" in the mtb_shared directory to avoid redundancy, but during the build process I would want to combine the library with a local project copy of "FreeRTOSConfig.h" to customize the build.
Show LessEsteemed Contributor
Contributor II
Employee
Employee
Esteemed Contributor
Employee
Honored Contributor
Contributor
New Contributor II
Contributor