Code Examples Forum Discussions
Tool: modustoolbox 2.2
Chip: CYW20706 (CYW920706WCDEVAL)
Hello.
I'm preparing project with CYW20706.
I found spp sample.
GitHub - Infineon/mtb-example-btsdk-rfcomm-spp: SPP app
But I'm experiencing link error with spp.c
[spp.c]
/* create SDP records */
wiced_bt_sdp_db_init((uint8_t *)sdp_database, sdp_database_len);
[Build result]
spp.c:437:37: error: 'sdp_database' undeclared (first use in this function)
437 | wiced_bt_sdp_db_init((uint8_t *)sdp_database, sdp_database_len);
My request.
Can I have good sample for my project?
Hi,
I'm a big fan of Infineon's UART component. I use the UART component (UART_v2_50) on 90% of my projects I tend to use it in 8N1 mode. I have no issues with it in this mode.
However in a recent project I've been requested to work on, it uses MARK and SPACE parity in the data across a proprietary LAN to signal all clients special information.
Sadly, I have found that selectively transmitting MARK or SPACE on specific bytes of the packet transmission not to be working correctly. SPACE parity is the default parity. I can get it to output MARK parity but not reliably or predictively.
I have asked on two other threads about receiving an example project from others about a successful MARK/SPACE parity control. Aside from help from @BiBi_1928986, I've read about others unsuccessful attempts as I achieved. @BiBi_1928986 provided an example project with a complicated circuit to get around a "logic" issue with the UART_v_2_50 implementation.
To solve this issue in a more 'elegant' (and reliable) solution, I have created my own UART_Tx component with proper MARK/SPACE control on a byte-for-byte basis.
I looked at 'fixing' the UART_v2_50 component. This was not going to happen anytime soon. If you look behind the 'curtain' on this component, you will find it VERY, VERY, VERY complicated. It has a lot of "bells and whistles" of features to support the ancient UART format along with the modifications that industry has added to it over time.
My component UART_SMTx_v1_00 is a "no-frills" component. It has the following features and lack of features:
- UART Tx only. No Rx is supported. I found the UART_v2_50 works to detect Rx MARK/SPACE parity correctly.
- The mode supported is (8MS1) 8-bit data, MARK/SPACE parity, 1 START bit and STOP bit. See the next note.
- The component was designed using the UDB Editor. All the editor design content is included in case you wanted to study or modify it to your needs. For example, it would be fairly simple to change the data size, the number of STOP bits, etc.
- UART API functions (Tx-only blocking and non-blocking) are modified to include a parity parameter. This is to provide familiar API functions with similar functionality.
- Each UDB has two 4-byte FIFOs. My version of the component uses BOTH FIFOs. One is used for the data and the other for the desired parity. The two FIFOs are loaded in sync with one another to correctly control the desired parity to the byte. Therefore the blocking and non-blocking UART API functions have been updated with a parity parameter and can be safely queued 4-deep for efficient CPU/application processing. In theory, with correct loading of the FIFOs (parity first then the data last), DMA can be used. Note: This is an improvement over the intended UART_v2_50 implementation.
- If you have a data array over 4 bytes, use the PutArray() function for blocking or the WriteTxData() with ReadTxStatus() validation for non-blocking.
- I've provided a Tx_En output for half-duplex or LAN peer-to-peer multiplexing.
- I've provided a SW selectable interrupt output based on TX_COMPLETE, FIFO_EMPTY, FIFO_NOT_FULL and FIFO_FULL status.
- Since this component is 'hardcoded' all the parameters are read-only.
- I have no component datasheet. However, I have tried to reasonably comment the UDB editor file and the .c and .h files.
- I have attached a simple demo project that alternates between a polled (blocking) and interrupt (non-blocking) implementation of transfer of a short set of data and parity.
- In the demo, I send 10 bytes with selected MARK or SPACE parity. I have included the Infineon UART component to read the transmitted data. The debugger output to a terminal program displays the data along with the parity detected ('_' prior to the hex data => SPACE ... OR ... hex data without a preface char => MARK.
- The project was built on a CY8CKIT-059 but can be run virtually any PSoC5LP or PSoC3. (The PSoC3 may require some minor modifications and have not been tested).
- The component files are included in the project itself. It is included in a directory called "UART_SMTx_v1_00". This simplifies incorporating the component into a new project. Just drop the entire directory into your new project.
This project is free for your use in your project. (No warranty is expressed or implied) You can modify it if needed.
If you have any problems or have suggestions, please post to this forum thread.
Show LessI have posted this sample code as one of the protection control example using the Firmware API.
[Overview]
You can confirm the followings using this sample code :
1, You can easily enable/disable D-Flash read/write protection parmanently by key=0 and key=1 commands.
2, You can confirm temporary protection/un-protection usage by key=2 and key=3 commands.
3, You can check that you can’t write D-Flash data while D-Flash R/W protection is enabled using #4 and #5 commands.
4, You can show the current protection status by key=7 command.
[Environment]
Confirmed evaluation boards :
1) TLE984x Evalboard
2) TLE9844-2QX Application Kit
IDE :
1)uVision V5.38.0.0
Software :
1) TLE984x_FW_API_Protection_v0.zip
[Usage of this software]
1, Program this software into the TLE984x of the evaluation board
2, Connect your PC and an evaluation board by USB cable
3, Lunch a terminal software and set 115200bps
4, Push RESET-SW of your evaluation board, then terminal software shows the following menu. Please follow the menu.
If you want to try Mass-erase function using a wrong password, please comment out line 85 of main.c of the below.
Line 85 //#define MASS_ERASE_ENABLE;
Caution : If you perform the mass-erase (Key=b) function, you need uIO Stick for full recovery.
[TEST example]
// You can confirm that your TLE984x will be protected and can’t connect with your debugger like a uVISION.
step 01 Press Key= 7 : Show protect status. (unlock status)
step 02 Press Key= 0 : Set permanent D-Flash read and write protection.
step 03 --- push RESET-switch on your evaluation board. ---
step 04 Press Key= 7 : Show protect status. (lock status)
// You can confirm that R/W protected D-Flash can’t write by FW-API.
step 05 Press Key= 8 : Show D-Flash memory data.
step 06 Press Key= 4 : Write D-Flash, but you can’t. (data pattern 0x30,0x31,0x32,0x33... )
step 07 Press Key= 8 : Show D-Flash memory data.
// You can write to the protected D-Flash memory with pre-temporary clear protection (unlock status).
step 08 Press Key= 3 : Clear D-Flash read and write protection temporary.
step 09 Press Key= 7 : Show protect status. (unlock)
step 10 Press Key= 4 : Write D-Flash. (data pattern 0x30,0x31,0x32,0x33... )
// You can confirm the temporary unlock status will be canceled by RESET.
step 11 --- push RESET-switch on your evaluation board. ---
step 12 Press Key= 7 : Show protect status. (lock status)
// You can clear permanent D-Flash read and write protection after RESET. And you can write D-Flash.
step 13 Press Key= 1 : Clear D-Flash read and write protection permanently.
step 14 --- push RESET-switch on your evaluation board. ---
step 15 Press Key= 7 : Show protect status. (unlock status)
step 16 Press Key= 5 : Write D-Flash. (data pattern 0x00,0x01,0x02,0x03... )
For step 13, Key=9 or Key=a can be used inserted of Key=1. The result is the same.
Show LessHi,
iMOTION2go is pre-programmed with the latest version of the iMOTION™ firmware and the script-based demo which is running the small motor mounted on the board. As soon as the kit is powered up through the USB slot, the demo will start and periodically vary the speed of the motor and alternate its rotating directions.
But the .zip file iMOTION2Go Software Package is for MCEWizard and MCEdesigner.
I posted the software package for the brand new tool iMOTION Solution Designer (iSD)
- install iSD
- Download the zip file and extract it
- Open iSD and File -> Open Project -> Select "i2023_01_24 iMOTION2Go.cwproj"
Regards,
Kazu Hayashi
I have posted this sample code to check the waveform of the RESET pin and the values of the registers affected by WDT1 RESET/ SYS_FAIL RESET.
[Overview]
Using this sample code, you can see the following :
1, You can check the SYS_FAIL RESET period by your oscilloscope.
2, You can check the WDT1 REST by your oscilloscope.
3, You can check value of both PMU_RESET_SYS and PMU_WFS registers by the terminal software on your PC.
[Environment]
Confirmed evaluation boards :
1) TLE984x Evalboard
2) TLE9844-2QX Application Kit
IDE :
1)uVision V5.38.0.0
Software :
1) UART2_TTY_EXAMPLE_TLE984x_WDT1.zip
[Instructions]
1) Program this software into your evaluation board via uVision.
2) Execute any terminal software on your PC (ex. TeraTerm) and connect it with evaluation board at 115200bps.
3) Push RESET-SW on the evaluation board.
Then, you can see the register values by terminal software and RESET-pin pulse by oscilloscope, every RESET timing.
[Result]
1, SYS_FAIL RESET waveform :
You can see a 1sec of Fail Sleep period. Please refer to the waveform in the left.
2, WDT1 REST waveform :
In this code, WDP_SEL=0x3F(1.008sec). So, you can see 4 times of 32us glitch pulse. Please refer to the waveform in the bottom right. And the 5th time, Fail Sleep RESET can be confirmed.
About WDT1 RESET pulse :
I was surprised because I haven’t noticed that there is a RESET mode which RESET-pin will not be asserted.
WDT1 (Watchdog) RESET is that one. And I coudn7t find out such an explanation in the UM v1.3.
By the way, explanation of TLE987x UM v1.8 is almost same.
However, we have observed on the oscilloscope that the TLE987x does not assert the RESET pin at all when WDT1 occurs.
About SYS_FAIL RESET pulse :
TLE987x_UM has the following sentence.
However, there isn’t any explanation why the waiting time is 1 sec.
TLE987x_UM, Rev1.8, p22,
Sleep mode is activated after 5 consecutive watchdog failures or in case of supply failure (5 times). In this case,
MON is enabled as the wake source and cyclic wake-up is activated with 1 s of wait time.
There is no such statement in TLE984x UM v1.3, but I guess the same from my measurement results.
And about 1sec of the wait time, TLE987x_UM and TLE984x_UM have no description.
However, I think the SYS_FAIL period can be calculated with the default value of the PMU SLEEP register.
The off-time of the Cyclic mode is calculated to be 1.024 sec.
3, Value of both PMU_RESET_SYS and PMU_WFS registers of every RESET:
You can see the value of both registers as the below.
If you have any feedback, please let me know.
Thank you.
Hiro
Show Less
Provided below is PSoC5 Tachometer component (Tach24 v0.0), which allows continuous frequency monitoring of up to 24 parallel digital inputs.
Component uses reciprocal counters technique, providing uniform accuracy across entire operation frequency range. It was specifically designed to consume very little hardware resources per channel, leaving PSoC5 UDB Datapath available for other tasks. To fit 24 channels into single PSoC5 the Tachometer component utilizes rarely used resources: the DMA internal 12-bit counter, and 32-bit Design Wide Timer (DWT), available to Cortex M3 microcontrollers. See attached datasheet for details.
Component features:
* Up to 24 parallel inputs
* Output in Hz, mHz or RPM formats
* Doesn’t consume UDB Datapath resources
* Optional output median filter
* Optional timeout detection
* Optional stall detection
The component was tested using CY8KIT-059 PSoC5 prototyping kit. Demo projects are provided. Component is not compatible with PSoC4.
Attached archive contains component library, component datasheet and demo projects for PSoC5. Please read installation instructions in the readme.txt.
The component provided as-is, no liabilities. It is free to use and modify.
/odissey1
Figure 1. Tachometer example of sampling 8 inputs. Tachometer is configured for Hz output format with timeout enabled.
Figure 2. Tachometer performance sampling 8 parallel inputs. Inputs are provided with individual frequencies (~200 Hz) with 0.04 Hz offset from each other: (A) raw frequency readings, (B) with median filter enabled. The spurious artifacts display accuracy of the tachometer; without the filter they are less than ±0.04 Hz (200 ppm).
Hi,
I've just wrote my first sample program for XENSIV PAS CO2 Shield2Go for CY8CKIT-044.
Shematic
Pins
Tera Term logs
When the program starts, current command menu is shown.
At this stage, the sensor is in "idle mode"
To see the configuration settings, enter "status" command.
Then each status(es) are shown.
Measurement Rate is set to 5 sec, as the default value of 60 was too large for testing 😉
Entering "run" to the prompt start continous sensing.
I blew my breath to the sensor after 5 measurement,
so the co2 ppm rose there.
After running a while, I entered "stop" command,
which will change the mode to "idle", and the prompt will be shown again.
Entering "help" shows the command again.
moto
Show Less
Hi,
Last week, I posted a version for PSoC 4
And here is a version for PSoC 5LP (CY8CKIT-059)
At first I was thinking that only a few changes will be required...
but I was wrong my i2c_utility for PSoC 5LP needed a lot of fixes... orz
Tera Term log
Schematic
Pins
moto
Show Less
Here is the C# source code to a terminal program for a Windows PC.
Minimum System Requirements:
- Windows 7. A lower version may work but has not been tested.
- C# Compiler. I have compiled this on both Visual C# 2017 and 2019.
This code started as a simple PSoC UART (remote) to PC terminal application to replace Teraterm, Termite, RealTerm, etc.
I did this to eventually enhance the UART comm capabilities to include features such as
- Data logging (appending to a .csv file)
- Data Plotting. This includes saving the plots as a .png file or .csv.
This code has those features built in by using my packetizing protocol.
Disclaimer
You are allowed to use this source code “at-will” for commercial or non-commercial purposes. I DO NOT state or imply any warranty for the use of this code in-whole or in-part.
I've attached an archive of the source code and a .pdf that describes the use and the packetizing protocol.
Len
Message was edited by: Len Removed bin and obj directories. Makes for a smaller .zip. Will be rebuilt when compiled.
Show LessHi,
As I saw a discussion about this device
https://community.infineon.com/t5/PSoC-4/How-to-connect-an-Oled-to-CY8CKIT-041-41XX/td-p/386950
I purchased a 3 piece set from Amazon.
Since I did not have (or could not find) CY8CKIT-041-41XX,
I used TSoC (CY8C4146LQI-S433) board.
Schematic
Pins
When started, monitor of starting sequence and first help message is shown in the UART (Tera Term)
To display the test pattern, Enter "TestPatern" to the prompt.
void do_test_pattern(void)
{
char *ptr ;
do_clear_display() ;
ssd1306_fillrect(15, 10, 115, 20) ;
ssd1306_set_color(SSD1306_BLACK) ;
ssd1306_text_x = 16 ;
ssd1306_text_y = 11 ;
draw_string("SSD1306 I2C OLED") ;
ssd1306_set_color(SSD1306_WHITE) ;
ssd1306_line(10, 25, 120, 25) ;
ssd1306_text_x = 28 ;
ssd1306_text_y = 30 ;
draw_string("PSoC Version") ;
ssd1306_line(20, 40, 40, 60) ;
ssd1306_line(20, 60, 40, 40) ;
ssd1306_fillrect(50, 40, 70, 60) ;
ssd1306_circle(90, 50, 10) ;
}
I'm afraid that I have not tested all the functionalies, but it seems that most of the basic functions are working.
moto
Show Less