Skip to content

Commit 6392f5d

Browse files
committed
Updating CE220823
1 parent 6522179 commit 6392f5d

File tree

8 files changed

+488
-354
lines changed

8 files changed

+488
-354
lines changed
Binary file not shown.

CE220823_PSoC6_SMIFMemWriteAndRead/Source/main.c

Lines changed: 217 additions & 128 deletions
Large diffs are not rendered by default.

CE220823_PSoC6_SMIFMemWriteAndRead/Source/smif_mem.c

Lines changed: 200 additions & 168 deletions
Large diffs are not rendered by default.

CE220823_PSoC6_SMIFMemWriteAndRead/Source/smif_mem.h

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,71 @@
11
/******************************************************************************
2-
* File Name: smif_mem.c
2+
* File Name: smif_mem.h
33
*
4-
* Version: 1.0
4+
* Version: 2.0
55
*
6-
* Description: This file contains all the function prototypes required for
7-
* proper operation of QSPI component
6+
* Description:
7+
* This is the public interface header for smif_mem.c. This file contains the
8+
* functions to perform memory operations such as read, write, and erase on an
9+
* external memory device.
810
*
911
*******************************************************************************
1012
* Copyright (2018-2019), Cypress Semiconductor Corporation. All rights reserved.
1113
*******************************************************************************
1214
* This software, including source code, documentation and related materials
13-
* (Software), is owned by Cypress Semiconductor Corporation or one of its
14-
* subsidiaries (Cypress) and is protected by and subject to worldwide patent
15+
* ("Software"), is owned by Cypress Semiconductor Corporation or one of its
16+
* subsidiaries ("Cypress") and is protected by and subject to worldwide patent
1517
* protection (United States and foreign), United States copyright laws and
16-
* international treaty provisions. Therefore, you may use this Software only
17-
* as provided in the license agreement accompanying the software package from
18-
* which you obtained this Software (EULA).
18+
* international treaty provisions. Therefore, you may use this Software only as
19+
* provided in the license agreement accompanying the software package from which
20+
* you obtained this Software ("EULA").
1921
*
20-
* If no EULA applies, Cypress hereby grants you a personal, nonexclusive,
21-
* non-transferable license to copy, modify, and compile the Software source
22-
* code solely for use in connection with Cypress’s integrated circuit products.
23-
* Any reproduction, modification, translation, compilation, or representation
24-
* of this Software except as specified above is prohibited without the express
22+
* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
23+
* non-transferable license to copy, modify, and compile the Software source code
24+
* solely for use in connection with Cypress’s integrated circuit products. Any
25+
* reproduction, modification, translation, compilation, or representation of
26+
* this Software except as specified above is prohibited without the express
2527
* written permission of Cypress.
2628
*
2729
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
2830
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
2931
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
3032
* reserves the right to make changes to the Software without notice. Cypress
3133
* does not assume any liability arising out of the application or use of the
32-
* Software or any product or circuit described in the Software. Cypress does
33-
* not authorize its products for use in any products where a malfunction or
34-
* failure of the Cypress product may reasonably be expected to result in
35-
* significant property damage, injury or death (High Risk Product). By
36-
* including Cypress’s product in a High Risk Product, the manufacturer of such
37-
* system or application assumes all risk of such use and in doing so agrees to
38-
* indemnify Cypress against all liability.
34+
* Software or any product or circuit described in the Software. Cypress does not
35+
* authorize its products for use in any products where a malfunction or failure
36+
* of the Cypress product may reasonably be expected to result in significant
37+
* property damage, injury or death ("High Risk Product"). By including Cypress's
38+
* product in a High Risk Product, the manufacturer of such system or application
39+
* assumes all risk of such use and in doing so agrees to indemnify Cypress
40+
* against all liability.
3941
*******************************************************************************/
40-
#ifndef SOURCE_SMIF_MEM_H_
41-
#define SOURCE_SMIF_MEM_H_
42+
43+
#ifndef SOURCE_SMIF_MEM_H
44+
#define SOURCE_SMIF_MEM_H
4245

4346
#include "cy_pdl.h"
44-
#include "cycfg.h"
45-
#include "cycfg_qspi_memslot.h"
4647

47-
#include <stdio.h>
48-
#include <string.h>
48+
49+
/***************************************************************************
50+
* Global Constants
51+
***************************************************************************/
52+
/* Set it high enough for the sector erase operation to complete */
53+
#define MEMORY_BUSY_CHECK_RETRIES (750ul)
54+
55+
/* Timeout used in polling of the transfer status of SMIF block */
56+
#define SMIF_TRANSFER_TIMEOUT (1000ul) /* microseconds */
57+
4958

5059
/***************************************************************************
5160
* Function Prototypes
5261
***************************************************************************/
53-
void CheckStatus(char * msg, uint32_t status);
54-
void ReadMemory(SMIF_Type *baseaddr,
55-
cy_stc_smif_context_t *smifContext,
56-
uint8_t rxBuffer[],
57-
uint32_t rxSize,
58-
uint8_t *address);
59-
void WriteMemory(SMIF_Type *baseaddr,
60-
cy_stc_smif_context_t *smifContext,
61-
uint8_t txBuffer[],
62-
uint32_t txSize,
63-
uint8_t *address);
64-
void EraseMemory(SMIF_Type *baseaddr, cy_stc_smif_mem_config_t *memConfig,
65-
uint8_t *address,
66-
cy_stc_smif_context_t const *smifContext);
62+
cy_en_smif_status_t IsMemoryReady(cy_stc_smif_mem_config_t const *memConfig);
63+
cy_en_smif_status_t IsQuadEnabled(cy_stc_smif_mem_config_t const *memConfig, bool *isQuadEnabled);
64+
cy_en_smif_status_t EnableQuadMode(cy_stc_smif_mem_config_t const *memConfig);
65+
cy_en_smif_status_t ReadMemory(cy_stc_smif_mem_config_t const *memConfig, uint8_t address[], uint8_t rxBuffer[], uint32_t rxSize);
66+
cy_en_smif_status_t WriteMemory(cy_stc_smif_mem_config_t const *memConfig, uint8_t address[], uint8_t txBuffer[], uint32_t txSize);
67+
cy_en_smif_status_t EraseMemory(cy_stc_smif_mem_config_t const *memConfig, uint8_t address[]);
68+
69+
#endif /* SOURCE_SMIF_MEM_H */
70+
6771

68-
#endif /* SOURCE_SMIF_MEM_H_ */

CE220823_PSoC6_SMIFMemWriteAndRead/Source/stdio_user.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175

176176
/* Controls whether CR is added for LF */
177177
#ifndef STDOUT_CR_LF
178-
#define STDOUT_CR_LF 0
178+
#define STDOUT_CR_LF 1
179179
#endif /* STDOUT_CR_LF */
180180

181181
#if defined(__cplusplus)

CE220823_PSoC6_SMIFMemWriteAndRead/design.modus

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Design version="10" xmlns="http://cypress.com/xsd/cydesignfile_v1">
33
<ToolInfo version="1.0.0"/>
4-
<Device mpn="CY8C6247BZI-D54"/>
4+
<Device mpn="CY8C624ABZI-D44"/>
55
<Libraries>
66
<Library name="psoc6sw" version="1.1"/>
77
</Libraries>
@@ -77,6 +77,16 @@
7777
</Block>
7878
</Peripherals>
7979
<Pins>
80+
<Block location="ioss[0].port[0].pin[4]" alias="KIT_BTN1" template="mxs40pin" version="1.0">
81+
<Param id="DriveModes" value="CY_GPIO_DM_HIGHZ"/>
82+
<Param id="initialState" value="1"/>
83+
<Param id="vtrip" value="CY_GPIO_VTRIP_CMOS"/>
84+
<Param id="isrTrigger" value="CY_GPIO_INTR_DISABLE"/>
85+
<Param id="slewRate" value="CY_GPIO_SLEW_FAST"/>
86+
<Param id="driveStrength" value="CY_GPIO_DRIVE_FULL"/>
87+
<Param id="sioOutputBuffer" value="true"/>
88+
<Param id="inFlash" value="true"/>
89+
</Block>
8090
<Block location="ioss[0].port[11].pin[2]" alias="" template="mxs40pin" version="1.0">
8191
<Param id="DriveModes" value="CY_GPIO_DM_STRONG_IN_OFF"/>
8292
<Param id="initialState" value="1"/>
@@ -137,7 +147,7 @@
137147
<Param id="sioOutputBuffer" value="true"/>
138148
<Param id="inFlash" value="true"/>
139149
</Block>
140-
<Block location="ioss[0].port[13].pin[7]" alias="KIT_LED2" template="mxs40pin" version="1.0">
150+
<Block location="ioss[0].port[13].pin[7]" alias="KIT_LED1" template="mxs40pin" version="1.0">
141151
<Param id="DriveModes" value="CY_GPIO_DM_STRONG_IN_OFF"/>
142152
<Param id="initialState" value="1"/>
143153
<Param id="vtrip" value="CY_GPIO_VTRIP_CMOS"/>
@@ -277,6 +287,14 @@
277287
<Port name="cpuss[0].dap[0].swj_swo_tdo[0]"/>
278288
<Port name="ioss[0].port[6].pin[4].digital_out[0]"/>
279289
</Net>
290+
<Net>
291+
<Port name="ioss[0].port[5].pin[0].digital_inout[0]"/>
292+
<Port name="scb[5].uart_rx[0]"/>
293+
</Net>
294+
<Net>
295+
<Port name="ioss[0].port[5].pin[1].digital_inout[0]"/>
296+
<Port name="scb[5].uart_tx[0]"/>
297+
</Net>
280298
<Net>
281299
<Port name="ioss[0].port[11].pin[2].digital_out[0]"/>
282300
<Port name="smif[0].spi_select0[0]"/>
@@ -301,14 +319,6 @@
301319
<Port name="ioss[0].port[11].pin[7].digital_inout[0]"/>
302320
<Port name="smif[0].spi_clk[0]"/>
303321
</Net>
304-
<Net>
305-
<Port name="ioss[0].port[5].pin[0].digital_inout[0]"/>
306-
<Port name="scb[5].uart_rx[0]"/>
307-
</Net>
308-
<Net>
309-
<Port name="ioss[0].port[5].pin[1].digital_inout[0]"/>
310-
<Port name="scb[5].uart_tx[0]"/>
311-
</Net>
312322
<Net>
313323
<Port name="peri[0].div_16[0].clk[0]"/>
314324
<Port name="scb[5].clock[0]"/>

CE220823_PSoC6_SMIFMemWriteAndRead/modus.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ CY_EXAMPLE_NAME = CE220823_SMIFMemWriteAndRead
5151
#
5252
# Description of the example project to display
5353
#
54-
CY_EXAMPLE_DESCRIPTION = Demonstrates read/write operation to external memory by using Serial memory interface(SMIF) in Quad Serial peripheral interface (QSPI) mode. This example also checks the integrity of the read data against written data.
54+
CY_EXAMPLE_DESCRIPTION = Demonstrates interfacing with an external NOR flash memory using the Serial Memory Interface (SMIF) block in Quad Serial Peripheral Interface (QSPI) mode. This example also checks the integrity of the read data against written data.
5555

5656
#
5757
# New project dialog inclusion

CE220823_PSoC6_SMIFMemWriteAndRead/readme.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ CE220823_SMIFMemWriteAndRead
44

55
Requirements
66
------------
7-
Tool: ModusToolbox™ IDE
7+
Tool: ModusToolbox™ IDE 1.1
88
Programming Language: C
99
Associated Parts: All PSoC 6 MCU parts
1010

1111
Supported Kits
1212
--------------
1313
PSoC 6 BLE Pioneer Kit
1414
PSoC 6 WiFi-BT Pioneer Kit
15-
PSoC 6 WiFi-BT Prototyping Kit
15+
PSoC 6 Wi-Fi BT Prototyping Kit
1616

1717
Overview
1818
--------
19-
Demonstrates read/write operation to external memory by using Serial memory
20-
interface(SMIF) in Quad Serial peripheral interface (QSPI) mode.
19+
Demonstrates interfacing with an external NOR flash memory using the Serial
20+
Memory Interface (SMIF) block in Quad Serial Peripheral Interface (QSPI) mode.
2121
This example also checks the integrity of the read data against written data.
2222

2323
Build and Program

0 commit comments

Comments
 (0)