background image

38

CY8CKIT-017 CAN/LIN Expansion Board Kit Guide, Doc. # 001-57814 Rev. *D

Code Examples

5.1.4.3

POT_IN

The POT_IN pin is used to input the analog signal from the potentiometer. The pin’s drive mode is
configured as High Impedance Analog, which is the default value.

Figure 5-11.  POT_IN Configuration: Pins > Type Tab

Figure 5-12.  POT_IN Configuration: Pins > General Tab

Содержание CY8CKIT-017

Страница 1: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D Cypress Semiconductor 198 Champion Court San Jose CA 95134 1709 Phone USA 800 858 1810 Phone Intnl 408 943 2600 http www cypress com ...

Страница 2: ... the express written permission of Cypress Disclaimer CYPRESS MAKES NO WARRANTY OF ANY KIND EXPRESS OR IMPLIED WITH REGARD TO THIS MATE RIAL INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Cypress reserves the right to make changes without further notice to the materials described herein Cypress does not assume any liability arising out o...

Страница 3: ... 12 2 4 Hardware Installation 12 3 Kit Operation 13 3 1 Introduction 13 3 2 Programming PSoC 3 Device 13 3 3 Hardware Connections 16 3 3 1 CAN Communication Hardware Setup 16 3 3 2 LIN Communication Hardware Setup 18 3 4 Verify Functionality 20 3 4 1 CAN Communication 20 3 4 2 LIN Communication 20 3 5 Using a CAN Bus Analyzer Tool 22 3 6 Using a LIN Bus Analyzer Tool 22 4 Hardware 23 4 1 System Bl...

Страница 4: ...ng Output 33 5 1 4 PSoC Creator Project Details 33 5 1 4 1 CAN 34 5 1 4 2 ADC 36 5 1 4 3 POT_IN 38 5 1 4 4 STATUS_REG 39 5 1 4 5 BUS_CLK 39 5 1 4 6 LOOPCLK 40 5 1 4 7 LCD 41 5 1 4 8 CAN_TX 41 5 1 4 9 CAN_RX 42 5 1 4 10 CAN_EN 44 5 1 4 11 CAN_LED_OK 45 5 1 4 12 CAN_LED_WARN 46 5 1 4 13 CAN_LED_ERR 47 5 1 4 14 Design Wide Resources 48 5 2 Code Example 2 CAN_Example_2 50 5 3 Code Example 3 LIN_Exampl...

Страница 5: ... affect its performance and cause interference with other apparatus in the immediate vicinity If such interference is detected suitable mitigating measures should be taken The CY8CKIT 017 as shipped from the factory has been verified to meet with requirements of CE as a Class A product The CY8CKIT 017 contains electrostatic discharge ESD sensitive devices Electrostatic charges readily accumulate o...

Страница 6: ...D workstation If one is not available use appropriate ESD protection by wearing an antistatic wrist strap attached to chassis ground any unpainted metal surface on your board when handling parts Handling Boards CY8CKIT 017 boards are sensitive to ESD Hold the board only by its edges After removing the board from its box place it on a grounded static free surface Use a conductive foam pad if availa...

Страница 7: ...Y8CKIT 001 to develop applications for a particular PSoC device family This kit is also compatible with the CY8CKIT 030 PSoC 3 Development Kit The EBK can be attached to port E of the CY8CKIT 030 DVK A CY8CKIT 030 kit can generally be substituted for a CY8CKIT 001 kit when using the CY8CKIT 017 kit Therefore any information regarding the CY8CKIT 001 kit in this document generally applies to the CY...

Страница 8: ...s and get to market faster PSoC Creator also enables you to tap into an entire tools ecosystem with integrated compiler tool chains RTOS solutions and production programmers to support both PSoC 3 and PSoC 5 1 4 Getting Started To get started see the Kit Operation chapter on page 13 for a description of the kit operation and how to program the PSoC 3 device Code examples are used to explain how to...

Страница 9: ... 12 16 2011 Updated images for PSoC Creator version 2 0 D 09 11 2012 Added a code example for the LIN component and included updates related to LIN throughout the document Added Safety Information chapter on page 5 and Regulatory Compliance Information on page 62 Convention Usage Courier New Displays file locations user entered text and source code C cd icc Italics Displays file names and referenc...

Страница 10: ...10 CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D Introduction ...

Страница 11: ...BKSetup exe 3 Follow all on screen prompts to proceed with the installation When installing the kit software the installer checks if the prerequisite software is installed in your system These include PSoC Cre ator PSoC Programmer Windows Installer NET Acrobat Reader and Keil Complier If these applications are not installed the installer prompts you to download and or install them 2 2 2 Installati...

Страница 12: ...of the CY8CKIT 001 DVK Note This document explains how to use this EBK with port A of the CY8CKIT 001 DVK You can also attach this board to port B or port C of CY8CKIT 001 DVK and port E of CY8CKIT 030 DVK You need to modify pin assignments of the example projects to use with other ports See Port Options with CY8CKIT 001 DVK on page 28 for pin assignment details and limitations of using with CY8CK...

Страница 13: ...e 22 for information on alternative ways of using this kit Code Example 3 LIN_Example This project demonstrates the LIN slave functionality of PSoC 3 It receives an unconditional frame having eight bytes of data from the LIN bus with frame ID 0x10 The eight bytes are Byte 1 is the scalar signal of 7 bit length and Byte 2 to 8 are the byte array signal of 7 byte length This is written to another un...

Страница 14: ...cessor Module Power and MiniProg3 Connection with CY8CKIT 001 DVK Note See the PSoC Development Kit Board Guide for details on connecting and programming PSoC devices 4 Click on the code example CAN_Example_1 located in Examples and Kits on the Start Page of PSoC Creator Figure 3 2 PSoC Creator Start Page ...

Страница 15: ...is saved in that folder 6 Build the project by selecting the Build option Figure 3 3 Build Project 7 Click the Program icon Figure 3 4 Program Option 8 The project is programmed successfully 9 Reset the device by pressing the SW4 switch on the DVK see Figure 3 5 Figure 3 5 Reset 10 Follow steps 1 through 9 to program other code examples CAN_Example_2 and LIN_Example on PSoC 3 ...

Страница 16: ...meter VR slot in CY8CKIT 001 DVK to the P1_6 on the DVK as shown in Figure 3 6 Figure 3 6 VR Connected to P1_6 on CY8CKIT 001 DVK 4 On both DVK boards power the VR by setting the jumper J11 to ON position Figure 3 7 Jumper J11 to ON position on CY8CKIT 001 DVK 5 The remaining jumper settings on both DVKs should be in the default state See the PSoC Devel opment Kit Board Guide for the default setti...

Страница 17: ...4 Rev D 17 Kit Operation Figure 3 8 Connected CAN LIN EBK Boards 7 Power up one DVK board with the 12 V power supply Then power up the other DVK with a 12 V power supply The second DVK must be powered up within approximately 5 seconds of powering the first DVK ...

Страница 18: ...s shown in Figure 3 9 Figure 3 9 EBK to Port A of CY8CKIT 001 DVK 2 Set VDD SELECT switch SW3 on the DVK to the 5 V position The remaining jumper settings on the DVK must be set to or left at the default state Figure 3 10 VDD Select 3 Connect Vbat LIN bus and GND of the LIN analyzer LIN master to S_LIN P5 connector of EBK See LIN Bus Connectors on page 26 for details of LIN bus connectors ...

Страница 19: ...814 Rev D 19 Kit Operation Figure 3 11 Connect to S_LIN 4 Connect a 12 V power supply adapter which is supplied along with the CY8CKIT 001 DVK to the power jack of the DVK Note If you are using the CY8CKIT 030 PSoC 3 DVK connect the CY8CKIT 017 EBK to port E ...

Страница 20: ...n may not work correctly if the PSoC devices are not using an accurate external clock source See CAN Bus Clock Accuracy on page 24 for details on oscillator requirements Figure 3 12 Verifying LCD Output of CAN_Example_1 3 4 2 LIN Communication 1 When the LIN_Example project starts the LIN Slave component is initialized If the startup is suc cessful the LINS Initialize Successful message is display...

Страница 21: ...s byte array signal of 7 byte length with a frame ID of 0x10 from the LIN ana lyzer master The frame ID and values of data received are displayed after Recd Data on the LCD This data will be displayed for 12 seconds Figure 3 14 Received Data Display 4 After 12 seconds the LCD display changes to Send ID 0x11 to read back data Send a frame with an ID of 0x11 from the LIN analyzer master 5 When the f...

Страница 22: ...f this kit s code examples If you use any other CAN node to communicate with this kit then you may need to modify the firm ware to allow communication You can modify the code examples firmware or settings of the other CAN node 3 6 Using a LIN Bus Analyzer Tool The LIN_Example project demonstrates functionality of the LIN slave device so the LIN master device must be also used The LIN bus analyzer ...

Страница 23: ...ach of these transceiver circuits enables a digital CMOS PSoC device to interface with a physical CAN or LIN bus respectively Without these transceiver circuits it is impossible for CMOS devices to communicate with other CAN or LIN nodes on a CAN or LIN bus The EBK ID functional block consists of two circuits that are not populated and can therefore be ignored These circuits exist to provide forwa...

Страница 24: ...device used as the CAN controller must meet this requirement If the native internal oscillator tolerance of the PSoC device is greater than 0 5 then some external clock source that is more accurate must be used For example an external oscillator or an external crystal can be used with the PSoC to improve the accuracy of the clocks in the PSoC device Footprints for oscillator and crystal devices an...

Страница 25: ... resistor is active JP2 is populated by default Figure 4 2 JP2 Jumper 4 2 4 Choke Footprint A footprint for a common mode signal suppression choke is available on the expansion board but it is not populated This footprint can be populated with a B82789C0 or equivalent choke to suppress common mode signals on the CAN bus If a choke component is mounted on the L1 footprint resistors R4 and R12 must ...

Страница 26: ...tails on each of the three signals of the LIN transceiver 4 3 1 LIN Bus Connectors The following table shows the pinout of both of the 3 pin LIN connectors P4 and P5 on the expansion board Table 4 2 LIN Connector Pinouts By default pin 1 of both LIN connectors P4 and P5 are left floating However if the LIN1EXTPWR jumper JP4 is populated pin 1 of the LIN1 connector is connected to the VIN power rai...

Страница 27: ... and NWAKE2 respectively 4 3 4 LIN Master and Slave Configurations By default the LIN1 circuit has a LIN master configuration and the LIN2 circuit has a LIN slave configuration Table 4 3 shows how footprints in each circuit are populated by default to make a master or slave configuration The components can be replaced as shown by Table 4 3 to change the circuit from a master to slave or vice versa...

Страница 28: ...in Port A Port B Port C CAN LIN EBK 1 P3_7 P1_7 P9_7 EBK_SEL 2 P3_6 P1_6 P9_6 ERR_LED 3 P3_5 P1_5 P9_5 OK_LED 4 P3_4 P1_4 P9_4 CAN_RX 5 P3_3 P1_3 P9_3 CAN_TX 6 P3_2 P1_2 P9_2 CAN_EN 7 P3_1 P1_1 P9_1 NC 8 P3_0 P1_0 P9_0 NC 9 GND GND GND GND 10 RESRV 11 RESRV 3 RESRV 14 NC 11 P5_7 P2_7 P8_7 NC 12 P5_6 P2_6 P8_6 LIN1_TX 13 P5_5 P2_5 P8_5 LIN2_TX 14 P5_4 P2_4 P8_4 LIN1_RX 15 P5_3 P2_3 P8_3 LIN2_NSLP 1...

Страница 29: ...h Serial Wire Debug SWD interface It is not possible through JTAG and Serial Wire Viewer SWV debug interfaces because expansion board circuits conflict with GPIO pins of these JTAG and SWV interfaces 4 6 Power Supply Configurations By default the CAN LIN expansion board is powered from the CY8CKIT 001 DVK through the 40 pin 2 20 connector The expansion board has a selection jumper on it JP6 that m...

Страница 30: ...o a LIN1 connector pin The LIN2EXTPWER jumper JP5 is used to connect the VIN supply to a LIN2 connector pin Warning Take extra care when populating any of the JP3 JP4 or JP5 jumpers These jumpers should only be populated when only one VIN power supply exists in the system 4 7 Default Switch and Jumper Settings Jumpers on the CY8CKIT 017 CAN LIN expansion board have a default setting for 5 V operat...

Страница 31: ...xample_1 project the CAN component is configured to transmit messages at a baud rate of 500 kbps in full TX RX mode This CAN node has a transmit ID of 0x2FF and a receive ID of 0x3FF The potentiometer present on the first CY8CKIT 001 DVK is sampled by a Sigma Delta ADC that is configured with 8 bit resolution and a sampling rate of 10 ksps The result of the conversion is stored in a variable in th...

Страница 32: ...r and Red TxError 127 or RxError 127 Turn On Red Turn Off Amber Turn On Amber Turn Off Red RxFlag 1 Copy Received Data to Variable Update received value on LCD No Yes Yes No Delay 5 seconds Display Communciation Starting on LCD Enable global interrupts and Start LOOPCLK LOOPISR Delay 1 second Display Introduction message on LCD Start Start CAN LCD ADC Turn On Green LED No Yes Turn Off Green LED No...

Страница 33: ...ng the project s pinout For more information on hardware connections see Hardware Connections on page 16 5 1 3 Verifying Output As you vary the potentiometer of the first CY8CKIT 001 DVK observe the change in the transmitted byte information on the first line of LCD present on the CY8CKIT 001 DVK The same value is reflected as the received byte information on the second line of the LCD present on ...

Страница 34: ...mission mode is set to full TX RX mode The CAN_Example_2 project has the same settings except that the transmit message ID is set to 0x3FF and the receive message ID is set to 0x2FF Notes For details of parameters refer to the component datasheets The component figure shows only tabs in which settings have been changed from default states or in which critical settings exist for proper operation An...

Страница 35: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D 35 Code Examples Figure 5 6 CAN Configuration Interrupt Tab Figure 5 7 CAN Configuration Receive Buffers Tab ...

Страница 36: ...Expansion Board Kit Guide Doc 001 57814 Rev D Code Examples Figure 5 8 CAN Configuration Transmit Buffers Tab 5 1 4 2 ADC The ADC component is used to sample the potentiometer input Figure 5 9 ADC Configuration Configure Tab ...

Страница 37: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D 37 Code Examples Figure 5 10 ADC Configuration Common Tab ...

Страница 38: ...amples 5 1 4 3 POT_IN The POT_IN pin is used to input the analog signal from the potentiometer The pin s drive mode is configured as High Impedance Analog which is the default value Figure 5 11 POT_IN Configuration Pins Type Tab Figure 5 12 POT_IN Configuration Pins General Tab ...

Страница 39: ...OPCLK clock component The output of this register is used to detect the rising edge of the LOOPCLK in this project Figure 5 13 STATUS_REG Configuration Configure Tab 5 1 4 5 BUS_CLK The BUS_CLK is used as the latching clock for the STATUS_REG component This is an existing high frequency clock in the chip Figure 5 14 BUS_CLK Configuration Configure Clock Tab ...

Страница 40: ... 001 57814 Rev D Code Examples 5 1 4 6 LOOPCLK LOOPCLK is configured to generate a 100 Hz clock which is used to generate a 10 ms period in the firmware Figure 5 15 LOOPCLK Configuration Configure Clock Tab Figure 5 16 LOOPCLK Configuration Advanced Tab ...

Страница 41: ...the transmitted and received bytes along with their transmit and receive IDs Figure 5 17 LCD Configuration General Tab 5 1 4 8 CAN_TX CAN_TX is the CAN bus transmit signal pin This pin is configured as an output pin with a strong drive mode It must be connected to the CAN TX input of the external CAN transceiver Figure 5 18 CAN_TX Configuration Pins Type Tab ...

Страница 42: ...e 5 19 CAN_TX Configuration Pins General Tab 5 1 4 9 CAN_RX CAN_RX is the CAN bus receive signal pin This pin is configured as an input pin with a high imped ance drive mode It must be connected to the CAN RX pin of the external CAN transceiver Figure 5 20 CAN_RX Configuration Pin Type Tab ...

Страница 43: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D 43 Code Examples Figure 5 21 CAN_RX Configuration Pins General Tab Figure 5 22 CAN_RX Configuration Pins Input Tab ...

Страница 44: ...1 57814 Rev D Code Examples 5 1 4 10 CAN_EN CAN_EN is external CAN transceiver enable signal pin This pin is configured as an output pin with strong drive mode Figure 5 23 CAN_EN Configuration Pins Type Tab Figure 5 24 CAN_EN Configuration Pins General Tab ...

Страница 45: ...AN_LED_OK CAN_LED_OK is configured as a software controlled output pin with strong drive mode and initial state as high This pin is connected to the green LED on the CY8CKIT 017 CAN LIN EBK Figure 5 25 CAN_LED_OK Configuration Pins Type Tab Figure 5 26 CAN_LED_OK Configuration Pins General Tab ...

Страница 46: ...ED_WARN CAN_LED_WARN is configured as a software controlled output pin with strong drive mode and initial state as high This pin is connected to the amber LED on the CY8CKIT 017 CAN LIN EBK Figure 5 27 CAN_LED_WARN Configuration Pins Type Tab Figure 5 28 CAN_LED_WARN Configuration Pins General Tab ...

Страница 47: ...N_LED_ERR CAN_LED_ERR is configured as a software controlled output pin with strong drive mode and initial state as high This pin is connected to the red LED on the CY8CKIT 017 CAN LIN EBK Figure 5 29 CAN_LED_ERR Configuration Pins Type Tab Figure 5 30 CAN_LED_WARN Configuration Pins General Tab ...

Страница 48: ...gure 5 31 Pin Connection Mapping for Port A of CY8CKIT 001 DVK This code example only works if the PSoC 3 device is using its External Crystal Oscillator ECO circuit with a 24 MHz external crystal See CAN Bus Clock Accuracy on page 24 for more information on clock source requirements for the PSoC CAN controller All clock settings of this code example are shown in Figure 5 32 and Figure 5 33 on pag...

Страница 49: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D 49 Code Examples Figure 5 32 Clock Setting Figure 5 33 System Clock Configuration ...

Страница 50: ... 3 Code Example 3 LIN_Example In the LIN_Example project LIN Slave component is configured with a baud rate of 19200 and two unconditional frames of eight bytes length One frame is of type Subscribe for data reception and the other frame is of type Publish for data transmission The InFrame is of unconditional type with Frame ID 0x10 eight bytes long and direction set to Subscribe The OutFrame is o...

Страница 51: ... ID 0x10 xx xx xx xx xx xx xx xx data present in signals InSig1 and InArraySig on LCD Is Flag of OutFrame Set Write Data of Signal InArraySig to OutArraySig Display DataSent ID 0x11 xx xx xx xx xx xx xx xx data present in signals OutSig1 and OutArraySig on LCD No Yes Clear LCD Display Set Reset LCD_TimerCntr Variable to 0 Start the Timer to count 12 seconds Is Flag Data_Recvd_First Cap Set Yes Set...

Страница 52: ...only when the EBK is connected to port A of the CY8CKIT 001 DVK You can modify the code example to work on other ports of the DVK See Design Wide Resources on page 48 for details on changing the project s pinout For more information on hardware connections see Hardware Connections on page 16 5 3 4 Verifying Output See the verify functionality described in section LIN Communication on page 20 for t...

Страница 53: ... 5 3 5 1 LIN Slave LIN slave is the core component in this code example Notes For details of parameters see the component datasheets The component figure shows only tabs in which settings have been changed from default states or in which critical settings exist for proper operation Any tabs not shown have default settings This is valid for all components of all code examples ...

Страница 54: ...54 CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D Code Examples Figure 5 37 LIN Configuration General Tab Figure 5 38 LIN Configuration Baud Rate Tab ...

Страница 55: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D 55 Code Examples Figure 5 39 LIN Configuration Frames Tab Figure 5 40 LIN Configuration Signals Tab ...

Страница 56: ...ter LCD The character LCD is used to display the user interface messages received transmitted data and frame IDs Figure 5 41 Character LCD Configuration General Tab 5 3 5 3 Timer Timer uses UDB based implementation and period is configured to 6 seconds Figure 5 42 Timer Configuration Configure Tab ...

Страница 57: ...ign Wide Resources The pin assignment in this code example matches port A of the CY8CKIT 001 DVK To use this EBK on port B or port C of the DVK open the code example and change the pin assignment in PSoC Creator in the cydwr file to match port B or port C according to Table 4 4 on page 28 The pin assignment for this code example is shown in Figure 5 44 ...

Страница 58: ...ide Doc 001 57814 Rev D Code Examples Figure 5 44 Design Wide Resources Table 5 2 Pin Assignments details of LIN Example Project Signal CY8CKIT 001 DVK Port A CY8CKIT 030 DVK Port E LCD P2 6 0 P2 6 0 L_RXD P5 1 P0 1 L_TXD P5 5 P0 5 NSLP P5 3 P0 3 ...

Страница 59: ...CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D 59 Code Examples Figure 5 45 Clock Settings Figure 5 46 System Clock Configuration ...

Страница 60: ...60 CY8CKIT 017 CAN LIN Expansion Board Kit Guide Doc 001 57814 Rev D Code Examples ...

Страница 61: ...x1 HEADER 1 2 3 GND2 GND2 R39 TBD R39 TBD JP4 2x1 HEADER JP4 2x1 HEADER 1 2 C4 0 1uF C4 0 1uF TP2 TP2 R34 ZERO R34 ZERO P2 DB9 FEMALE _CAN CONN P2 DB9 FEMALE _CAN CONN 5 9 4 8 3 7 2 6 1 R20 ZERO R20 ZERO R35 ZERO R35 ZERO TP14 TP14 D8 PMLL4148L 115 D8 PMLL4148L 115 U1 TJA1050 U1 TJA1050 TXD 1 GND 2 VCC 3 RXD 4 Vref 5 CANL 6 CANH 7 S 8 CAN_L CAN_L R4 ZERO R4 ZERO TP6 TP6 R28 1K R28 1K 15V 24V D5 PE...

Страница 62: ...P 75V 200MA SOD80C NXP Semiconductors PMLL4148L 115 11 4 JP2 JP3 JP4 JP5 CONN HEADR BRKWAY 100 02POS STR Tyco Electronics 9 146280 0 02 12 1 JP6 CONN HEADER 6POS 100 STR 15AU FCI 67996 206HLF 13 2 JP2 JP6 SHUNT GOLD W HANDLE BLACK Kobiconn 151 8030 E 14 1 P1 CONN HEADER 100 DUAL R A 40POS Sullins Connector Solutions PBC20DBAN 15 1 P2 CONN D SUB RCPT R A 9POS 30GOLD AMP Division of TYCO 5747844 4 1...

Отзывы: