Code Examples Forum Discussions
Overview
The purpose of this code example is to show the users how they can handle the different sector architecture types in Infineon serial NOR flash devices.
Requirements
Tool: PSoC® Creator™ 4.4
Programming Language: C (Arm® GCC 5.4.1)
Related Hardware: S25FS512S SPI NOR flash memory, PSoC 6 BLE Pioneer Kit
Software and Driver: Infineon Low Level Driver for SPI Flash
Hardware Setup
This example requires the PSoC 6 MCU’s VDD supply voltage to be set to 1.8V, since the FS-S NOR flash device family works at 1.8V power supply.
Software Setup
This example requires a serial terminal emulator such as PuTTY or Tera Term. Tera Term was used in this example.
Operation
Refer to KBA233140 Hybrid sector architecture of Infineon FL/FS-S serial NOR flash devices to get a better understanding of sector architecture.
The default configuration of the S25FS-S device can be determined by reading the third bit of Non-Volatile Configuration Register 3. The default value of CR3NV[3] bit is 0 indicating hybrid sector architecture. When the device is in hybrid sector architecture mode, the Parameter 4 KB-Sector Erase command (P4E 20h) is used to erase the 4-KB parameter sectors. If Sector Erase command (SE D8h) is applied on the 4-KB parameter sector, it is not affected by the erase. The CR3NV[3] bit is user programmable and can be set to 1 to change the device configuration to uniform sector architecture mode. However, this can be done only once as the bit is One Time Programmable (OTP). When the device is in uniform sector architecture mode, the overlay of the 4-KB parameter sectors is removed and all the sectors in the device are of uniform size (256KB). In this mode, the Sector Erase (SE D8h) command should be used to erase each individual sector and the Parameter 4 KB-Sector Erase command (P4E 20h) does not have any effect on the uniform sectors.
In this code example we have chosen the S25FS512S SPI NOR flash and interfaced it with PSoC 6 using SPI protocol.
Steps performed in the example:
- Initialize UART and SPI
- Read Device ID to make sure HW connections are okay
- Read 5 bytes from the starting address (0x000000). By default, the 4-KB parameter sectors are overlaid at the bottom location
- Program 5 bytes at starting location (0x000000)
- Read 5 bytes from starting location to confirm
- Erase first sector with P4E (0x20) command
- Read 5 bytes from starting location to confirm (erase is successful)
- Read CR3NV register
- If CR3NV[3] bit is 0 (device is in hybrid sector architecture mode)
- Program 5 bytes at starting location
- Read 5 bytes from starting location to confirm
- Erase first sector with SE (0xD8) command
- Read 5 bytes from starting location to confirm (erase is not performed on parameter sector)
- Program CR3NV[3] bit to 1 (change device configuration to uniform sector architecture mode)
- Read CR3NV register to confirm
- Erase first sector with SE (0xD8) command again
- Read 5 bytes from the starting location to confirm (erase is successful)
- Else if CR3NV[3] bit is 1 (device is already in uniform sector architecture mode)
- Print that device is in uniform sector architecture mode
Design and Implementation
Connections:
S25FS512S Flash |
CY8CKIT-062-BLE |
MISO |
P12[1] |
MOSI |
P12[0] |
SCK |
P12[2] |
CS# |
P12[3] |
VCC |
P6_VDD |
VSS |
GND |
PSoC Creator Schematic:
Note: The Slave Select (SS) pin of the SPI block (SPIM_Flash) was disabled. The same pin (P12[3]) was used as a GPIO (Flash_CS) in the project so that the flash CS# line can be controlled manually, as per the requirement of the Infineon sLLD.
Expected Output:
When the example is executed on a fresh S25FS512S NOR flash device (CR3NV[3] = 0)
When the example is re-executed on the same device (CR3NV[3] = 1)
Show Less
OV_THR How should this value be set and understood?
4.6 V / VOVUV_LSB = 3AEH
Why is the 4.6V setting 3AE?
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/%E4%BE%8B%E7%A8%8B/TLE9012DQU-0x02%E5%9C%B0%E5%9D%80-%E8%AE%BE%E7%BD%AE%E8%BF%87%E5%8E%8B%E9%98%80%E5%80%BC%E5%A6%82%E4%BD%95%E7%90%86%E8%A7%A3/td-p/712120
Show Less
Actually this is a sibling sample of my previous post
I assumed "PCF8574" for I2C - LCD interface modue.
And this time, I tried to create a project from "Empty Project".
Fisrt specify the workspace
MTB WorkBench shows up
Create a new project using Meanu: File > New > ModusToolbox Application
Choose a bsp, this time unfold the "PSoC 6 BSPs"
Selected a board "CY8CPROTO-063-BLE" for BSP
For Application template, I checked "HAL I2C Master" from "Peripherals"
and I named the project "HAL_I2C_CharLCD"
Now a new project is created.
Then we need to import the following source and header files from the attached archive file "i2c_new_files.zip"
i2c_clcd.h, i2c_clcd.c, i2c_utils.h, i2c_utils.c
Then overwrite main.c with the one in the attached archive file.
Actually these could be done just copy and paste these 5 files into the project folder.
Now connect, VCC, GND, SCL(P6[4]), SDA (P6[5]) between the I2C Module and CY8CPROTO-063-BLE.
Building and downloading the project will show "Hello" for 2 seconds then start counting.
moto
Show Less
Recently I received a request to port my very old sample to ModusToolbox (MTB hereon).
https://community.infineon.com/t5/Code-Examples/CharLCD-Sample-for-PSoC-6-CY8CKIT-062-BLE/m-p/268325
Actually there was a MTB version for CY8CKIT-062-BLE, but the requester seemed having problem using it.
So I tried this on CY8CPROTO-063-BLE.
Meantime as the project size of MTB is handreds of MB, I resigned to upload the whole project,
instead I try to show the step by step operation to make this project work on MTB.
Since my post(s) over there was deep inside the discussion with very different title,
I decided to post this as a standalone CE discusson.
First, start the ModusToolbox and select the workspace.
The workbench shows up.
Select menu File > New > ModusToolbox Application
Choose a BSP for your board.
This time my board was CY8CPROTO-063-BLE.
Then select an application type. I chose "Getting Started"
I chose "Hello World". We can change the project name here,
so I changed it to "Hello_charLCD". (Any project name should be fine.)
"Hello_charLCD" project was created.
I unziped the "my_files.zip" attached.
I copied above files into the project folder.
Then these files were reflected in the project.
Then open "clcd.h" and enter defines of CLCD_DB7 ~ CLDC_DB4, CLCD_E, CLCD_RW, CLCD_RS
for your board.
Mine was something like below.
#include <stdint.h>
#define CLCD_DB7 (P9_6)
#define CLCD_DB6 (P9_5)
#define CLCD_DB5 (P9_4)
#define CLCD_DB4 (P9_3)
#define CLCD_E (P9_2)
#define CLCD_RW (P9_1)
#define CLCD_RS (P9_0)
#define CLCD_GPIO_Write(PIN, value) cyhal_gpio_write(PIN, value)
Then build the project.
After building the project, set up a serious terminal, such as Tera Term for "local echo"
Connect CharLCD as below.
Start the Debugger
At first, if everything is going OK, "CLCD Test" is printed in the CLCD.
Type "help" to show the command list.
Then type "pos 2 1" to more cursor to the next line.
Then type "print hello" to print "hello" there.
moto
Show Less
Hi,
I have managed to get the demo software available for the TLD7002-16ES to work on an Arduino Uno R3 but has anybody got it to work with an UNO R4?
If you have, could you share your code file?
Thanks
Jake
Show LessHardware: The example is running on the TraveoII starter kit CYTVII-B-E-1M-SK, populated with CYT2B75CAD.
Software: SDL Version 7.1.0 or 7.8.0, not shure
PDMA, Datawire and DW are synonyms.
The PDMA is repeatedly executing a 2Dtransfer to move 8 x 128 bytes from memory to the input of the SCB’s TXFifo. The SCB’s TXFifo is triggering the PDMA when empty.
The UART output can be monitored with a terminal program like PuTTY configured as COMx, 115200 Bd, 8N1.
Please find code attached.
Show LessHi,
let us share the pramaeter file for iMOTION2go with iMOTON Solution Designer (iSD) ver1.3.0 and FW ver5.3.7.
You can apply default parameter in iSD for iMOTION2go.
Then it is needed to modify many parameters as below.
GKpin/comp -> GKpin
GPIO7 no-check -> check, output
Retaed inverter output current 0.2Arm -> 0.5Arms
Maximum inverter DC-bus voltage 25V -> 20V
Bootstrap capacitor charge time per phase 3.33ms -> 10ms
Minimum single shunt phase shift active pulse 3us->2us
Motor rated amps/phase 0.4Arms -> 0.2Arms
Motor back EMF constant 38.000 -> 0.210
Motor nominal voltage 200Vrms -> 15Vrms
Motor type PM -> IPM
Stator resistanced/phase 38 -> 6.2
IPM motor stator Iq inductance/phase 195mH -> 0.58mH
IPM motor stator Id inductance/phase 192mH -> 0.52mH
Load type Select Item -> Simple
Rated power 100W -> 2W
Minimum speed 100 RPM -> 6000 RPM
Maximum speed 2730 RPM -> 16383 RPM
Speed control update rate scaler 2 -> 1
Speed feedback filter time constant 10ms -> 0.2ms
Speed regulator proportional gain 1.0 -> 0.25
Speed regulator integral gain 4rad/s -> 1.38 rad/s
Open loop ramp rate 200rpm/s -> 800rpm/s
Regeneration current limit 0% -> 5%
Low speed limit 40% -> 90%
Low speed threshold 200rpm -> 6000rpm
Speed control input ramp rate imit 100rpm/s -> 800rpm/s
Flux estimator time constant 15ms -> 10ms
DC bus critical overvoltage fault level 23.8V -> 19V
Overvoltage fault enable no-check -> check
Undervoltage fault enable no-check -> check
Rotor lock fault enable no-check -> check
Phase loss fault enable check -> no-check
Current Offset Protection check -> no-check
The .zip file is used for iMOTION2Go and iSD ver1.3.0 and FW ver5.3.7. It can be used as is without modification.
Usage:
- install iSD ver1.3.0 (skip if already done)
- Download the zip file and extract it
- Open iSD and File -> Open Project -> Select "i2024_03_04 iMOTION2Go_for_pack5.3.7_iSD1.3.0.cwproj" in "settings" folder.
- Build and program
- Start motor in dashboard, slide target speed to adjust RPM
Best Regards,
Hayashi.K
Show Less
This Code Example demonstrates the function of the fast comparator. The threshold for fast comparator channel 0 is set to 2/VAREF, and when the input voltage exceeds this threshold, the FC interrupt occurs and P33.7 is toggled.
installations
TC397XP
development board
The TC397 Triboard was used for testing.
precondition
The BIFACES tool and Tasking compiler are required.
compiling
Import to Biface and modify the Tasking compiler installation path for Tricore.
# Title or name of your project
This example demonstrates the function of fast comparator. The threshold of fast comparator channel 0 is set to 2/VAREF, when the input voltage is beyond the threshold, the interrupt of FC occurs and P33.7 is toggled .
## Device
TC397XP
## Board
Board used for testing is TC397 Triboard
## Prerequisites
BIFACES tool and Taskig compiler
## Compiling
Import to Biface, modify the Tasking Compiler installation path for Tricore
### Infineon (optional)
add the infineon logo
! [Alt text](Readme_Files/infineon_logo.png?raw=true "Infineon logo ")
Please refer to the attached document for details
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/%E4%BE%8B%E7%A8%8B/TC397XP-the-function-of-fast-comparator-%E5%BF%AB%E9%80%9F%E6%AF%94%E8%BE%83%E5%99%A8%E7%9A%84%E5%8A%9F%E8%83%BD/td-p/706117
Show LessI often need to create menus consisting of different number of items, and while the program is running, some items can be added and others removed, it creates confusion.
For example
1) previous page
2)...
3)...
4) next page
And here in the first page there is no item 1 and in the last page there is no item 4 and this has to be considered while entering the value.
I want to share a simple solution, it helped me a lot.
uint8 MenuSel (uint16 options,uint8 numel)
{
uint8 count=0,result=1;
while(options)
{
if(options & 1)
{
count++;
if(count==numel) return result;
}
options>>=1;
result++;
}
if(numel==0) return count;
return 0;
}
It's easy to use:
for example this is a complete list of all possible options
//Menu create:
//1) other
//2) save item
//3) save group
//4) see items here
//5) back
//6) no matter, exit now
//we only need to display options 3,6 uint8 menuset=0b100100;//exit+savegroup activate
//or add option 4 if(t2) menuset|=0b1000;//option 4 activate
//or remove option 4 if(t2) menuset &=~0b1000;//option 4 deactivate
temp=1;
do
{
temp1=MenuSel(menuset,temp);
if(temp1)
{
Printnum(temp);//Other
PrintMess(138+temp1,MessNext);//"other"
}
temp++;
}while(temp1);
numvars=Saynum(1,MenuSel(menuset,0),MessEnd);//Enter number from 1 to N
numvars is the number of the selected option from the full list,
PrintMess should output the text of the desired option from the list.
Show LessThis code example provides a solution to the question, 'Did anyone enter your house while you were away?' The example uses the XENSIV™ DEMO BGT60TR13C 60GHz radar board and the presence_detection.py in the Radar Development Kit (RDK) with some minor modifications to allow you to receive notifications on your phone.
The example utilizes a programmable communication tool called 'Twilio'. Although there are many similar tools such as Sinch and Plivo available, the implementation process is quite similar.
To get started, create an account in Twilio using your email ID and password. Once this is done, you will receive a Twilio phone number from which the messages will be sent, an Account String Identifier (Account SID), and an Authentication token (Auth Token) to facilitate the process.
After creating a Twilio account, you need to follow these steps:
- Install the required Python wheels from the Radar Development Kit [radar_sdk\python_wheels].
- Open the presence_detection.py file from the Python examples [radar_sdk\examples\py\BGT60TR13C].
- Install the "twilio" package using "pip install twilio".
- Include the "twilio" package and the following code snippet at the beginning of the code:
Now, follow the steps below to send the presence status to your phone:
- Make the necessary modifications to the code using the following snippet:
- After making the changes, run the code to receive the message on your phone!
Upon detection of presence at your place, you will receive an SMS notification.
Show Less