Code Examples Forum Discussions
Hi
When communicating data using the component's Slave Select (SS) on the SPI master, SS becomes inactive when the TX FIFO becomes empty.
Therefore, in many cases, I think that the SS signal is controlled by software with GPIO output.
In the case of SPI master communication for a few bytes which is not so many, it is also possible to use "Criticalsection" like this sample code.
Try it in your application. However, please conduct sufficient evaluation.
I connected FRAM as an SPI slave because I needed a communication partner, so it doesn't have to be FRAM. Therefore, 2 bytes of data are transferred, but 3 bytes of Instruction (OPcode) and address are added, so a total of 5 bytes are sent.
If SW2 is pressed, 2-byte data are written to FRAM and then read. The write buffer and read buffer are compared and the result is output to the PC terminal software using UART. The read operation is performed 5 times and the write buffer and read buffer are compared each time.
There are two types of 2-byte data, and each time SW2 is pressed, they are alternately written to FRAM.
Criticalsection specification can be removed by commenting out the #define critical_section line in “FRAM_SPI.h”.
SPI communication with FRAM doesn't work because the TX FIFO is empty halfway through.
The serial port settings of terminal software are as follows.
baud rate: 115200bps
data length: 8bit
parity: none
stop bit: 1bit
Show Less
Hi,
This sample code is a I2C pseudo master for evaluation of I2C slave with error handling as below.
https://community.infineon.com/t5/Code-Examples/I2C-slave-error-handling-for-CY8CKIT-145-40XX/m-p/218789
The counterpart I2C slave is the same as the EZI2C with a 1-byte buffer. The base address following
the I2C slave address must be 0 and there is a 1 byte buffer.
Please see the attached I2C pseudomaster Function ID.pdf. Sending the Function ID in the table
with the PC terminal software outputs the waveform on the right side from the pseudo I2C master.
An example of terminal software is Infineon's SerialPortViewer. The left window is the I2C pseudo master.
When you send Function ID 0x14(dec:20), I2Cslave receives 0x12.
Similarly, if you send Function ID 0x19(dec:25) I2Cslave will occur I2CS_I2C_SSTAT_RD_ERR.
Thanks and regards,
Show LessHello,
This sample code implements SPI master and DMA for RX (RxDmaM) and DMA for TX (TxDmaM) components on CY8CKIT-149(CY8C4147AZI-S475). Access to FRAM is performed once for a write operation of 1K bytes data stored in the FLASH memory, and divided into eight read operations with a size of 128 bytes. When SW1 is pressed, write operation is performed, then read operation and compare is performed.
Descriptors 0 and 1 each have a size of 16 bytes and are continuously transmitted by a chain.
Terminal software settings are shown as an example using Tera Term.
The transferred data and comparison result are below.
The data in FLASH are 2K bytes, and the first half 1K and the second half 1K are alternately sent to FRAM each time SW1 is pressed.
Best regards,
Yocchi
Show Less
The heat of the Year End and the New Year hustle has calmed down.
But I've been struggling with my private project, which is a Fingerprint Scanner, namely GT-521F32.
Anyway, finally I could come up with the initial working version.
Although we've already been familiar with a Fingerprint Scanner with iPhones and Smartphones,
I wanted to play with one. And I found a reasonable priced one.
Fingerprint Scanner - TTL (GT-521F32) - SEN-14518 - SparkFun Electronics
So I gave a try, since it is connected via UART, it seems to be easy to handle.
Well, communicating with module was easy, but control the device was another story (at least to me).
The schematic looks like
According to the programming guide term, to register a finger print is "enroll".
Since finding 200 person sounds difficult, I used a few of my fingers to try.
I enrolled my left thumb as 0, left index as 1, right thumb as 2, right index as 3...
To enroll a finger, the device requires us to release and touch the finger 3 times.
Then we can identify a finger (print) if it's enrolled or verify if enrolled finger can be verified correctly.
moto
Show LessI have just posted this code for your reference.
[Overview]
This code is an example to executing RAM code in the RAM memory area.
You can reuse this project if you want to execute specific code in the RAM.
RAM code file name = RamCode.c
code area = 0x1800_0000 ~ 0x1800_0FFF
Please refer to [RAM code settings] for more detail.
If your RAM code is larger than 0xFFF size, you need to adjust code size in the
"Options for file 'RamCode.c'" by right-click on the RamCode.c file.
This code can measure the execution time of both Flash and RAM with an oscilloscope
by monitoring the P0.5 pin. (fSYS=LP_CLK)
P0.5:
First Hi period = RAM execution time of 100 times NOP code. (about 5.7us)
2nd Hi period = Flash execution time of 100 times NOP code. (about 11us)
P0.4:
Output fSYS clock (LP_CLK is selected while execution of the NOP test code.)
[Environment]
Confirmed evaluation boards : TLE984x Evalboard
IDE : uVision V5.36.0.0
Software : TLE9844_2QX_Proj_RAMcode.zip
[Instructions]
1) Program this software into your evaluation board via uVision
2) Connect oscilloscope at P0.4 and P0.5 if you want to measure the execution time.
3) Run from uVision
[RAM code settings]
① Right-click on the RamCode.c file
② Select “Options for File ’xxx’” from the menu
③ Input RAM code address range. (Should be larger than actual code size)
[Execution image]
Show Less
This is a demo project showing simple Sine / Ramp / Triangle wave generator using software DDS generator and double-buffered DMA. It is designed to operate on PSoC5 boards.
In this demo, the wave data (e.g. sine) is stored in FLASH as a 8-bit wavetable, and the sine data is pulled from the table at constant sampling clock. The run-time sine phase is calculated using 32-bit software DDS calculator, while only top 8 bits are used for sine phase. The data are adjusted for amplitude and stored in the temporary RAM buffer of the WaveGenLT. The Wave custom component encapsulates all DDS-related code.
Calculated data are transferred from the RAM buffer to the VDAC8 using double-buffered DMA. The buffer consists of two halves; the data from one half are fed into VDAC while another half is being populated by CPU. Such approach allows for high VDAC update rates (~1MHz), while interrupt requests for the buffer update come at much slower rate (~4kHz). The WaveGenLT custom component encapsulates all DMA-related code.
As shown, at 48MHz BUS_CLK the time to populate a half-buffer is approx. 50us, resulting in average CPU load of 20%. Highest achievable output frequency (with optional external low-pass filter) is about 100-150kHz (with 1MHz sampling clock).
Attached demo project includes all necessary components. It also allows for amplitude and frequency sweep. All components provided as-is, no datasheets available at this time.
/odissey1
Figure 1. Project schematic. DDS sampling clock is 512kHz, VDAC scale is 4V. The WaveGenLT total buffer length is set to 256 (128+128). Wave p-p amplitude is set to 255.
Figure 2. Project annotation for CY8CKIT-059 Prototyping Board using PSoC Annotation Library v1.0.
Figure 3. Sine wave output. Frequency - 1 kHz, amplitude p-p 4V, offset 2V. The slight deviation of the output frequency (1.014kHz vs. preset value of 1.000kHz) is due to the inaccuracy of the IMO clock of the PSoC5.
Figure 4. FFT of the sine wave output. Frequency 1 kHz, amplitude p-p 4V, offset 2V. THD is better than 40dB.
Figure 5. Ramp wave output. Frequency 1 kHz, amplitude p-p 4V, offset 2V.
Figure 6. VDAC sine output with amplitude modulation and persistent display. Frequency - 1 kHz Amplitude sweep from 25 to 255, center offset 2V.
Show Less
This is an example code to show you how to establish both IIC and full-duplex UART tuner communication in a PSoC4100S Max CapSense project.
Example is created based on below environment:
ModusToolBox version: 3.0.0.2684
CapSense Tuner version: 5.0.0.2450
CapSense Middleware version: 3.0.0.2705
CY8CKIT-041S-MAX Pioneer Kit Rev 05
Show Less
I have just posted this code for your reference.
[Overview]
This code is based on a " UART2 sample code for TLE984x" sample code which I posted it before.
This sample code is simply get all ADC2 data and then show both 8bit hex data and unit-converted values.
So, you can see Central temperature and LS module temperature, too.
This code has three functions as the below.
Key=1: VDDEXT_LED = On
Key=2: VDDEXT_LED = Off
Key=3: Show ADC2 data (Ch0~Ch6)
Each function can execute by key input via terminal software on your PC.
For example, If you type [1] key then VDDEXT_LED will be turn on.
[Environment]
Confirmed evaluation boards :
1) TLE984x Evalboard ( J16 = JP27 = JP28 = Short)
2) TLE9844-2QX Application Kit
IDE :
1)uVision V5.36.0.0
Software :
1) UART2_TTY_EXAMPLE_TLE984x_ADC2.zip
[Execution image]
The following screenshot shows the user pressing the "3" key after RESET.
[Question]
If anybody know about the below, please advise me.
It seems, there is a case where ADC2/Ch1(VDDEXT) value may doesn’t match the VDDEXT-pin voltage.
1) After reset, VDDEXT_ENABLE=0. And both ADC2/Ch1(VDDEXT) value and VDDEXT-pin voltage are 0v.
2) If you set VDDEXT_ENABLE=1(Key=1), then both ADC2/Ch1(VDDEXT) value and VDDEXT-pin voltage are 5v.
3) After that, if you clear VDDEXT_ENABLE=0(Key=2), then ADC2/Ch1(VDDEXT) value is remain 5V while VDDECT-pin voltage is 0V. This is a strange phenomenon, I think.
If I have any misunderstanding about ADC2 module/functions or if there is mistake in my code, please let me know.
Thank you very much in advance.
Show LessAll,
let me share the script and Japanese document. I hope this AN will be useful for you.
The script has been checked no syntax error and good behavior of the script with IMC101T-T038 v1.03.03.
c.f. AN2021-14 in English
Constant air-flow control using iMOTION™ script language
Best Regards,
Kazunari Hayashi
All,
if you check first behavior of "XMC4700 Relax Kit Lite", this article is helpful for you.
1. Open DAVE
2. Import "CCU4_SLICE_CONFIG_EXAMPLE_XMC47"
3. Build & start debug it
4. You can check PWM signal as "2022_05_10 XMC4700 Relax Kit Lite試用.pdf"
Best Regards,
Kazunari Hayashi