psoctools | example configs

Some example configurations for tutorial and reference purposes.
        
    openocd --verbose -c "interface kitprog; kitprog_init_acquire_psoc" -f target/psoc5lp.cfg
    telnet localhost 4444
        
        

example 0: light up the blue led (portpin 2.1) through a DSI block

        
    ;# light up the blue led on portpin 2.1 when 3.3v is applied to portpin 2.2
    ;# routes through DSI5_DSIINP into DSI5_HC and back out through DSIOUTT to the blue led
    psoc5lp.cpu mwb 0x40005110 0x00 96   ;# PRT1-PRT6
    psoc5lp.cpu mwb 0x400051C0 0x00 16   ;# PRT12_DR
    psoc5lp.cpu mwb 0x400051F0 0x00 16   ;# PRT15_DR
    psoc5lp.cpu mwb 0x40010000 0x00 4096 ;# UDB Bank 0
    psoc5lp.cpu mwb 0x40011400 0x00 2048 ;# UDB Bank 1
    psoc5lp.cpu mwb 0x40014000 0x00 2560 ;# DSI0
    psoc5lp.cpu mwb 0x40014C00 0x00 512  ;# DSI12
    psoc5lp.cpu mwb 0x40015000 0x00 32   ;# MDCLK_EN
    psoc5lp.cpu mwb 0x40005210 0x02 1    ;# PRT2_OUT_SEL0
    psoc5lp.cpu mwb 0x40005211 0x02 1    ;# PRT2_OUT_SEL1
    psoc5lp.cpu mwb 0x400145C0 0x02 1    ;# DSI5_DSIINP0
    psoc5lp.cpu mwb 0x400145D6 0x04 1    ;# DSI5_DSIOUTT1
    psoc5lp.cpu mwb 0x40005122 0x06 1    ;# PRT2_DM0
    psoc5lp.cpu mwb 0x40005123 0x06 1    ;# PRT2_DM1
    psoc5lp.cpu mwb 0x40005124 0x00 1    ;# PRT2_DM2
    psoc5lp.cpu mwb 0x40005125 0x00 1    ;# PRT2_SLW
    psoc5lp.cpu mwb 0x40005126 0x02 1    ;# PRT2_BYP
    psoc5lp.cpu mwb 0x40005127 0x00 1    ;# PRT2_BIE
    psoc5lp.cpu mwb 0x40005128 0x00 1    ;# PRT2_INP_DIS
    psoc5lp.cpu mwb 0x40005129 0x00 1    ;# PRT2_CTL
    psoc5lp.cpu mwb 0x40015003 0x02 1    ;# BCTL0_BANK_CTL
    psoc5lp.cpu mwb 0x40015013 0x02 1    ;# BCTL1_BANK_CTL

    psoc5lp.cpu mwb 0x40005120 0x04 1    ;# PRT2_DR -- light it up!
    sleep 3000
    psoc5lp.cpu mwb 0x40005120 0x00 1    ;# PRT2_DR -- turn it off
    sleep 3000
    psoc5lp.cpu mwb 0x40005120 0x04 1    ;# PRT2_DR -- light it up!
        
        

example 1: traverse two DSI blocks horizontally

Effectively all that needed to be added from the previous example was DSI5_HS8. The drive mode settings were changed to configure portpin 6.2 as input instead of portpin 2.2. DSIINP is now set up for DSI4 rather than DSI5 because port 6 is associated with DSI4.
        
    ;# light up the blue led on portpin 2.1 when 3.3v is applied to portpin 6.2
    psoc5lp.cpu mwb 0x40005110 0x00 96   ;# PRT1-PRT6
    psoc5lp.cpu mwb 0x400051C0 0x00 16   ;# PRT12_DR
    psoc5lp.cpu mwb 0x400051F0 0x00 16   ;# PRT15_DR
    psoc5lp.cpu mwb 0x40010000 0x00 4096 ;# UDB Bank 0
    psoc5lp.cpu mwb 0x40011400 0x00 2048 ;# UDB Bank 1
    psoc5lp.cpu mwb 0x40014000 0x00 2560 ;# DSI0
    psoc5lp.cpu mwb 0x40014C00 0x00 512  ;# DSI12
    psoc5lp.cpu mwb 0x40015000 0x00 32   ;# MDCLK_EN
    psoc5lp.cpu mwb 0x40005210 0x02 1    ;# PRT2_OUT_SEL0
    psoc5lp.cpu mwb 0x40005211 0x02 1    ;# PRT2_OUT_SEL1
    psoc5lp.cpu mwb 0x400144C0 0x02 1    ;# DSI4_DSIINP0
    psoc5lp.cpu mwb 0x400145D6 0x04 1    ;# DSI5_DSIOUTT1

    psoc5lp.cpu mwb 0x40014598 0x01 1    ;# DSI5_HS8

    ;# configure portpins 6.2 (input) and 2.1 (output to blue led)
    psoc5lp.cpu mwb 0x40005162 0x04 1    ;# PRT6_DM0
    psoc5lp.cpu mwb 0x40005163 0x04 1    ;# PRT6_DM1
    psoc5lp.cpu mwb 0x40005164 0x00 1    ;# PRT6_DM2
    psoc5lp.cpu mwb 0x40005165 0x00 1    ;# PRT6_SLW
    psoc5lp.cpu mwb 0x40005166 0x00 1    ;# PRT6_BYP
    psoc5lp.cpu mwb 0x40005167 0x00 1    ;# PRT6_BIE
    psoc5lp.cpu mwb 0x40005168 0x00 1    ;# PRT6_INP_DIS
    psoc5lp.cpu mwb 0x40005169 0x00 1    ;# PRT6_CTL
    psoc5lp.cpu mwb 0x40005122 0x02 1    ;# PRT2_DM0
    psoc5lp.cpu mwb 0x40005123 0x02 1    ;# PRT2_DM1
    psoc5lp.cpu mwb 0x40005124 0x00 1    ;# PRT2_DM2
    psoc5lp.cpu mwb 0x40005125 0x00 1    ;# PRT2_SLW
    psoc5lp.cpu mwb 0x40005126 0x02 1    ;# PRT2_BYP
    psoc5lp.cpu mwb 0x40005127 0x00 1    ;# PRT2_BIE
    psoc5lp.cpu mwb 0x40005128 0x00 1    ;# PRT2_INP_DIS
    psoc5lp.cpu mwb 0x40005129 0x00 1    ;# PRT2_CTL
    psoc5lp.cpu mwb 0x40015003 0x02 1    ;# BCTL0_BANK_CTL
    psoc5lp.cpu mwb 0x40015013 0x02 1    ;# BCTL1_BANK_CTL
    
    ;# apply 3.3v to portpin 6.2 or set it through software
    psoc5lp.cpu mwb 0x40005160 0x04 1    ;# PRT6_DR -- light it up!
    sleep 3000                                                     
    psoc5lp.cpu mwb 0x40005160 0x00 1    ;# PRT6_DR -- turn it off 
    sleep 3000                                                     
    psoc5lp.cpu mwb 0x40005160 0x04 1    ;# PRT6_DR -- light it up!

        
        

example 2: traverse many DSI blocks horizontally

        
    ;# light up the blue led on portpin 2.1 when 3.3v is applied to portpin 5.2
    ;# this example traverses many DSI blocks with the HS (Horizontal Segment) registers
    psoc5lp.cpu mwb 0x40005110 0x00 96   ;# PRT1-PRT6
    psoc5lp.cpu mwb 0x400051C0 0x00 16   ;# PRT12_DR
    psoc5lp.cpu mwb 0x400051F0 0x00 16   ;# PRT15_DR
    psoc5lp.cpu mwb 0x40010000 0x00 4096 ;# UDB Bank 0
    psoc5lp.cpu mwb 0x40011400 0x00 2048 ;# UDB Bank 1
    psoc5lp.cpu mwb 0x40014000 0x00 2560 ;# DSI0
    psoc5lp.cpu mwb 0x40014C00 0x00 512  ;# DSI12
    psoc5lp.cpu mwb 0x40015000 0x00 32   ;# MDCLK_EN
    psoc5lp.cpu mwb 0x40005210 0x02 1    ;# PRT2_OUT_SEL0
    psoc5lp.cpu mwb 0x40005211 0x02 1    ;# PRT2_OUT_SEL1
    
    psoc5lp.cpu mwb 0x40014DC0 0x02 1    ;# DSI13_DSIINP0
    
    ;# traverse many DSI blocks horizontally
    psoc5lp.cpu mwb 0x40014694 0x40 1    ;# DSI6_HS8
    psoc5lp.cpu mwb 0x40014794 0x40 1    ;# DSI7_HS8
    psoc5lp.cpu mwb 0x40014C94 0x40 1    ;# DSI12_HS8
    psoc5lp.cpu mwb 0x40014D94 0x40 1    ;# DSI13_HS8
    
    psoc5lp.cpu mwb 0x400145D6 0x04 1    ;# DSI5_DSIOUTT1
    
    psoc5lp.cpu mwb 0x40015003 0x02 1    ;# BCTL0_BANK_CTL
    psoc5lp.cpu mwb 0x40015013 0x02 1    ;# BCTL1_BANK_CTL
    
    psoc5lp.cpu mwb 0x40005122 0x02 1    ;# PRT2_DM0
    psoc5lp.cpu mwb 0x40005123 0x02 1    ;# PRT2_DM1
    psoc5lp.cpu mwb 0x40005124 0x00 1    ;# PRT2_DM2
    psoc5lp.cpu mwb 0x40005125 0x00 1    ;# PRT2_SLW
    psoc5lp.cpu mwb 0x40005126 0x02 1    ;# PRT2_BYP
    psoc5lp.cpu mwb 0x40005127 0x00 1    ;# PRT2_BIE
    psoc5lp.cpu mwb 0x40005128 0x00 1    ;# PRT2_INP_DIS
    psoc5lp.cpu mwb 0x40005129 0x00 1    ;# PRT2_CTL
    
    psoc5lp.cpu mwb 0x40005152 0x04 1    ;# PRT5_DM0
    psoc5lp.cpu mwb 0x40005153 0x04 1    ;# PRT5_DM1
    psoc5lp.cpu mwb 0x40005154 0x00 1    ;# PRT5_DM2
    psoc5lp.cpu mwb 0x40005155 0x00 1    ;# PRT5_SLW
    psoc5lp.cpu mwb 0x40005156 0x00 1    ;# PRT5_BYP
    psoc5lp.cpu mwb 0x40005157 0x00 1    ;# PRT5_BIE
    psoc5lp.cpu mwb 0x40005158 0x00 1    ;# PRT5_INP_DIS
    psoc5lp.cpu mwb 0x40005159 0x00 1    ;# PRT5_CTL
    
    ;# apply 3.3v to portpin 5.2 or set it through software
    psoc5lp.cpu mwb 0x40005150 0x04 1    ;# PRT5_DR -- light it up!
    sleep 3000
    psoc5lp.cpu mwb 0x40005150 0x00 1    ;# Turn it off
    sleep 3000
    psoc5lp.cpu mwb 0x40005150 0x04 1    ;# PRT5_DR -- light it up!
       
        

example 3: traverse VS (Vertical Segments) to get to the other row of DSI's

        
    ;# TODO