efm8 testing printing
This commit is contained in:
parent
0dab248a40
commit
40b11a945c
@ -29,7 +29,7 @@
|
||||
<option id="com.silabs.ide.si8051.keil.toolchain.category.general.debug.1285835962" name="Generate debug information" superClass="com.silabs.ide.si8051.keil.toolchain.category.general.debug" value="true" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si8051.keil.toolchain.category.general.extended_assembler.1124669083" name="Use Extended Assembler (AX51) instead of A51" superClass="com.silabs.ide.si8051.keil.toolchain.category.general.extended_assembler" value="true" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si8051.keil.toolchain.category.general.extended_linker.1220060828" name="Use Extended Linker (LX51) instead of BL51" superClass="com.silabs.ide.si8051.keil.toolchain.category.general.extended_linker" value="true" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si8051.keil.toolchain.category.general.memory_model.923432818" name="Memory model" superClass="com.silabs.ide.si8051.keil.toolchain.category.general.memory_model" value="com.silabs.ide.si8051.keil.toolchain.category.general.memory_model.small" valueType="enumerated"/>
|
||||
<option id="com.silabs.ide.si8051.keil.toolchain.category.general.memory_model.923432818" name="Memory model" superClass="com.silabs.ide.si8051.keil.toolchain.category.general.memory_model" value="com.silabs.ide.si8051.keil.toolchain.category.general.memory_model.large" valueType="enumerated"/>
|
||||
<targetPlatform binaryParser="com.silabs.ss.tool.ide.c8051.debug.OMF;com.silabs.ss.tool.ide.c8051.debug.OMF2;com.silabs.ss.framework.debugger.core.BIN;com.silabs.ss.framework.debugger.core.HEX;com.silabs.ss.framework.debugger.core.S37;com.silabs.ss.framework.debugger.core.EBL;com.silabs.ss.framework.debugger.core.GBL" id="com.silabs.ide.si8051.keil.targetplatform.1736873507" isAbstract="false" superClass="com.silabs.ide.si8051.keil.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/efm8}/Keil 8051 v9.53 - Debug" id="com.silabs.ide.si8051.keil.builder.699981897" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Keil Builder" parallelBuildOn="false" superClass="com.silabs.ide.si8051.keil.builder"/>
|
||||
<tool id="com.silabs.ide.si8051.keil.toolchain.compiler.161237451" name="Keil 8051 Compiler" superClass="com.silabs.ide.si8051.keil.toolchain.compiler">
|
||||
@ -70,7 +70,7 @@
|
||||
</tool>
|
||||
<tool command="LX51" id="com.silabs.ide.si8051.keil.toolchain.linker.367126547" name="Keil 8051 Linker" superClass="com.silabs.ide.si8051.keil.toolchain.linker">
|
||||
<option id="com.silabs.ide.si8051.keil.linker.category.general.use_control_file.117123054" name="Use linker control file" superClass="com.silabs.ide.si8051.keil.linker.category.general.use_control_file" value="false" valueType="boolean"/>
|
||||
<option id="com.silabs.ide.si8051.keil.linker.category.ordering.selection.1520457668" name="Linker input ordering" superClass="com.silabs.ide.si8051.keil.linker.category.ordering.selection" value="./src/InitDevice.OBJ;./src/SILABS_STARTUP.OBJ;./src/callback.OBJ;./src/descriptors.OBJ;./src/main.OBJ;./src/printing.OBJ;./lib/efm8ub1/peripheralDrivers/src/usb_0.OBJ;./lib/efm8_usb/src/efm8_usbd.OBJ;./lib/efm8_usb/src/efm8_usbdch9.OBJ;./lib/efm8_usb/src/efm8_usbdep.OBJ;./lib/efm8_usb/src/efm8_usbdint.OBJ;./lib/efm8_assert/assert.OBJ" valueType="string"/>
|
||||
<option id="com.silabs.ide.si8051.keil.linker.category.ordering.selection.1520457668" name="Linker input ordering" superClass="com.silabs.ide.si8051.keil.linker.category.ordering.selection" value="" valueType="string"/>
|
||||
<inputType id="com.silabs.ide.si8051.keil.linker.inputType.320881486" superClass="com.silabs.ide.si8051.keil.linker.inputType"/>
|
||||
</tool>
|
||||
<tool id="com.silabs.ide.si8051.keil.toolchain.librarian.1238681544" name="Keil 8051 Library Manager" superClass="com.silabs.ide.si8051.keil.toolchain.librarian"/>
|
||||
@ -170,7 +170,7 @@
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="com.silabs.ss.framework.ide.project.core.cpp" project.generation="25" projectCommon.boardIds="brd5000a:0.0.0.A02" projectCommon.buildArtifactType="EXE" projectCommon.importModeId="COPY" projectCommon.partId="mcu.8051.efm8.ub1.efm8ub10f16g-b-qfn28" projectCommon.sdkId="com.silabs.sdk.8051:4.1.1._-963069327"/>
|
||||
<storageModule moduleId="com.silabs.ss.framework.ide.project.core.cpp" project.generation="31" projectCommon.boardIds="brd5000a:0.0.0.A02" projectCommon.buildArtifactType="EXE" projectCommon.importModeId="COPY" projectCommon.partId="mcu.8051.efm8.ub1.efm8ub10f16g-b-qfn28" projectCommon.sdkId="com.silabs.sdk.8051:4.1.1._-963069327"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="efm8.com.silabs.ss.framework.ide.project.core.cdt.cdtMbsProjectType.972220390" name="SLS CDT Project" projectType="com.silabs.ss.framework.ide.project.core.cdt.cdtMbsProjectType"/>
|
||||
</storageModule>
|
||||
|
@ -7,7 +7,8 @@
|
||||
<property object="CLOCK_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="CLOCK_0" propertyId="clock.clockselect.clocksourcedivider" value="SYSCLK / 1"/>
|
||||
<property object="CLOCK_0" propertyId="clock.clockselect.selectclocksource" value="Internal High Frequency Oscillator 1"/>
|
||||
<property object="CROSSBAR0" propertyId="xbar0.uart1.data" value="Enabled"/>
|
||||
<property object="CROSSBAR0" propertyId="xbar0.spi0.clockdata" value="Enabled"/>
|
||||
<property object="CROSSBAR0" propertyId="xbar0.uart0.data" value="Enabled"/>
|
||||
<property object="DefaultMode" propertyId="mode.diagramLocation" value="100, 100"/>
|
||||
<property object="INTERRUPT_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="INTERRUPT_0" propertyId="interrupt.interruptenable.enableallinterrupts" value="Enabled"/>
|
||||
@ -17,6 +18,8 @@
|
||||
<property object="P0.3" propertyId="ports.settings.skip" value="Skipped"/>
|
||||
<property object="P0.4" propertyId="ports.settings.iomode" value="Digital Push-Pull Output"/>
|
||||
<property object="P0.4" propertyId="ports.settings.outputmode" value="Push-pull"/>
|
||||
<property object="P0.7" propertyId="ports.settings.iomode" value="Digital Push-Pull Output"/>
|
||||
<property object="P0.7" propertyId="ports.settings.outputmode" value="Push-pull"/>
|
||||
<property object="P1.4" propertyId="ports.settings.iomode" value="Digital Push-Pull Output"/>
|
||||
<property object="P1.4" propertyId="ports.settings.outputmode" value="Push-pull"/>
|
||||
<property object="P1.5" propertyId="ports.settings.iomode" value="Digital Push-Pull Output"/>
|
||||
@ -24,9 +27,20 @@
|
||||
<property object="P1.6" propertyId="ports.settings.iomode" value="Digital Push-Pull Output"/>
|
||||
<property object="P1.6" propertyId="ports.settings.outputmode" value="Push-pull"/>
|
||||
<property object="P2.0" propertyId="ports.settings.iomode" value="Digital Push-Pull Output"/>
|
||||
<property object="P2.0" propertyId="ports.settings.latch" value="Low"/>
|
||||
<property object="P2.0" propertyId="ports.settings.outputmode" value="Push-pull"/>
|
||||
<property object="PBCFG_0" propertyId="pbcfg.settings.enablecrossbar" value="Enabled"/>
|
||||
<property object="SPI_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="SPI_0" propertyId="spi.clockrate.spiclockfrequencyactual" value="1.000 MHz"/>
|
||||
<property object="SPI_0" propertyId="spi.clockrate.spiclockfrequencytarget" value="1000000"/>
|
||||
<property object="SPI_0" propertyId="spi.clockrate.sysclk" value="48.000 MHz"/>
|
||||
<property object="SPI_0" propertyId="spi.clockrate.sysclkdividercoefficientspi0ckr" value="23"/>
|
||||
<property object="SPI_0" propertyId="spi.control.slaveselectmode" value="Slave or master 3-wire mode"/>
|
||||
<property object="SPI_0" propertyId="spi.control.spienable" value="Enabled"/>
|
||||
<property object="TIMER01_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="TIMER01_0" propertyId="timer01.timer1highbyte.timer1highbyte" value="48"/>
|
||||
<property object="TIMER01_0" propertyId="timer01.timer1mode2:8bitcountertimerwithautoreload.targetoverflowfrequency" value="230400"/>
|
||||
<property object="TIMER01_0" propertyId="timer01.timer1mode2:8bitcountertimerwithautoreload.timerreloadvalue" value="48"/>
|
||||
<property object="TIMER16_2" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="TIMER16_2" propertyId="timer16.control.clocksource" value="SYSCLK"/>
|
||||
<property object="TIMER16_2" propertyId="timer16.control.runcontrol" value="Start"/>
|
||||
@ -41,16 +55,23 @@
|
||||
<property object="TIMER_SETUP_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.clockcontrol.timer2lowbyteclockselect" value="Use SYSCLK"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.clockcontrol.timer3lowbyteclockselect" value="Use SYSCLK"/>
|
||||
<property object="UARTE_1" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.clockcontrol0.timer01prescale" value="SYSCLK / 4"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.timer01control.timer1runcontrol" value="Start"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.timer1.clocksource" value="Use SYSCLK"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.timer1.mode" value="Mode 2, 8-bit Counter/Timer with Auto-Reload"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.timer1.timerrunningstate" value="Timer is Running"/>
|
||||
<property object="TIMER_SETUP_0" propertyId="timer_setup.timer1.timerswitch1:runcontrol" value="Start"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.actualbaudrate" value="115384"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.baudrateprescaler" value="Divide by 1"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.baudrateprescaler" value="Divide by 8"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.baudratereloadhigh" value="255"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.baudratereloadlow" value="48"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.baudratereloadlow" value="230"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.enablebaudrategenerator" value="Enabled"/>
|
||||
<property object="UARTE_1" propertyId="uarte.baudrategeneratorcontrol.expectedbaudrate" value="115200"/>
|
||||
<property object="UARTE_1" propertyId="uarte.serialportcontrol.enablereceive" value="Enabled"/>
|
||||
<property object="UART_0" propertyId="uart.serialportcontrol.actualbaudrate" value="93750 Baud"/>
|
||||
<property object="UART_0" propertyId="uart.serialportcontrol.timer1overflowfrequency" value="187.500 kHz"/>
|
||||
<property object="UART_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="UART_0" propertyId="uart.serialportcontrol.actualbaudrate" value="115384 Baud"/>
|
||||
<property object="UART_0" propertyId="uart.serialportcontrol.enablereceive" value="Enabled"/>
|
||||
<property object="UART_0" propertyId="uart.serialportcontrol.timer1overflowfrequency" value="230.769 kHz"/>
|
||||
<property object="USBLIB_0" propertyId="ABPeripheral.included" value="true"/>
|
||||
<property object="USBLIB_0" propertyId="configuration.configurationparameters.configurationstring" value="conf"/>
|
||||
<property object="USBLIB_0" propertyId="configuration.configurationparameters.devicepower" value="Bus-Powered"/>
|
||||
|
@ -23,10 +23,12 @@ extern void PORTS_2_enter_DefaultMode_from_RESET(void);
|
||||
extern void PBCFG_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void CIP51_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void CLOCK_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void TIMER01_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void TIMER16_2_enter_DefaultMode_from_RESET(void);
|
||||
extern void TIMER16_3_enter_DefaultMode_from_RESET(void);
|
||||
extern void TIMER_SETUP_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void UARTE_1_enter_DefaultMode_from_RESET(void);
|
||||
extern void SPI_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void UART_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void INTERRUPT_0_enter_DefaultMode_from_RESET(void);
|
||||
extern void USBLIB_0_enter_DefaultMode_from_RESET(void);
|
||||
// [Config(Per-Module Mode)Transition Prototypes]$
|
||||
|
@ -10,4 +10,7 @@
|
||||
|
||||
#define USE_PRINTING
|
||||
|
||||
void usb_transfer_complete();
|
||||
void spi_transfer_complete();
|
||||
|
||||
#endif /* INC_APP_H_ */
|
||||
|
@ -33,10 +33,12 @@ extern void enter_DefaultMode_from_RESET(void) {
|
||||
PBCFG_0_enter_DefaultMode_from_RESET();
|
||||
CIP51_0_enter_DefaultMode_from_RESET();
|
||||
CLOCK_0_enter_DefaultMode_from_RESET();
|
||||
TIMER01_0_enter_DefaultMode_from_RESET();
|
||||
TIMER16_2_enter_DefaultMode_from_RESET();
|
||||
TIMER16_3_enter_DefaultMode_from_RESET();
|
||||
TIMER_SETUP_0_enter_DefaultMode_from_RESET();
|
||||
UARTE_1_enter_DefaultMode_from_RESET();
|
||||
SPI_0_enter_DefaultMode_from_RESET();
|
||||
UART_0_enter_DefaultMode_from_RESET();
|
||||
INTERRUPT_0_enter_DefaultMode_from_RESET();
|
||||
USBLIB_0_enter_DefaultMode_from_RESET();
|
||||
// Restore the SFRPAGE
|
||||
@ -75,7 +77,6 @@ extern void INTERRUPT_0_enter_DefaultMode_from_RESET(void) {
|
||||
- Disable Timer 2 interrupt
|
||||
- Disable UART0 interrupt
|
||||
***********************************************************************/
|
||||
SFRPAGE = 0x00;
|
||||
IE = IE_EA__ENABLED | IE_EX0__DISABLED | IE_EX1__DISABLED
|
||||
| IE_ESPI0__DISABLED | IE_ET0__DISABLED | IE_ET1__DISABLED
|
||||
| IE_ET2__DISABLED | IE_ES0__DISABLED;
|
||||
@ -144,12 +145,12 @@ extern void PBCFG_0_enter_DefaultMode_from_RESET(void) {
|
||||
/***********************************************************************
|
||||
- Weak Pullups enabled
|
||||
- Crossbar enabled
|
||||
- UART1 TX1 RX1 routed to Port pins
|
||||
- UART1 I/O unavailable at Port pin
|
||||
- UART1 RTS1 unavailable at Port pin
|
||||
- UART1 CTS1 unavailable at Port pin
|
||||
***********************************************************************/
|
||||
XBR2 = XBR2_WEAKPUD__PULL_UPS_ENABLED | XBR2_XBARE__ENABLED
|
||||
| XBR2_URT1E__ENABLED | XBR2_URT1RTSE__DISABLED
|
||||
| XBR2_URT1E__DISABLED | XBR2_URT1RTSE__DISABLED
|
||||
| XBR2_URT1CTSE__DISABLED;
|
||||
// [XBR2 - Port I/O Crossbar 2]$
|
||||
|
||||
@ -157,6 +158,19 @@ extern void PBCFG_0_enter_DefaultMode_from_RESET(void) {
|
||||
// [PRTDRV - Port Drive Strength]$
|
||||
|
||||
// $[XBR0 - Port I/O Crossbar 0]
|
||||
/***********************************************************************
|
||||
- UART0 TX0, RX0 routed to Port pins P0.4 and P0.5
|
||||
- SPI I/O routed to Port pins
|
||||
- SMBus 0 I/O unavailable at Port pins
|
||||
- CP0 unavailable at Port pin
|
||||
- Asynchronous CP0 unavailable at Port pin
|
||||
- CP1 unavailable at Port pin
|
||||
- Asynchronous CP1 unavailable at Port pin
|
||||
- SYSCLK unavailable at Port pin
|
||||
***********************************************************************/
|
||||
XBR0 = XBR0_URT0E__ENABLED | XBR0_SPI0E__ENABLED | XBR0_SMB0E__DISABLED
|
||||
| XBR0_CP0E__DISABLED | XBR0_CP0AE__DISABLED | XBR0_CP1E__DISABLED
|
||||
| XBR0_CP1AE__DISABLED | XBR0_SYSCKE__DISABLED;
|
||||
// [XBR0 - Port I/O Crossbar 0]$
|
||||
|
||||
// $[XBR1 - Port I/O Crossbar 1]
|
||||
@ -167,27 +181,41 @@ extern void PBCFG_0_enter_DefaultMode_from_RESET(void) {
|
||||
extern void TIMER_SETUP_0_enter_DefaultMode_from_RESET(void) {
|
||||
// $[CKCON0 - Clock Control 0]
|
||||
/***********************************************************************
|
||||
- System clock divided by 12
|
||||
- System clock divided by 4
|
||||
- Counter/Timer 0 uses the clock defined by the prescale field, SCA
|
||||
- Timer 2 high byte uses the clock defined by T2XCLK in TMR2CN0
|
||||
- Timer 2 low byte uses the system clock
|
||||
- Timer 3 high byte uses the clock defined by T3XCLK in TMR3CN0
|
||||
- Timer 3 low byte uses the system clock
|
||||
- Timer 1 uses the clock defined by the prescale field, SCA
|
||||
- Timer 1 uses the system clock
|
||||
***********************************************************************/
|
||||
CKCON0 = CKCON0_SCA__SYSCLK_DIV_12 | CKCON0_T0M__PRESCALE
|
||||
CKCON0 = CKCON0_SCA__SYSCLK_DIV_4 | CKCON0_T0M__PRESCALE
|
||||
| CKCON0_T2MH__EXTERNAL_CLOCK | CKCON0_T2ML__SYSCLK
|
||||
| CKCON0_T3MH__EXTERNAL_CLOCK | CKCON0_T3ML__SYSCLK
|
||||
| CKCON0_T1M__PRESCALE;
|
||||
| CKCON0_T1M__SYSCLK;
|
||||
// [CKCON0 - Clock Control 0]$
|
||||
|
||||
// $[CKCON1 - Clock Control 1]
|
||||
// [CKCON1 - Clock Control 1]$
|
||||
|
||||
// $[TMOD - Timer 0/1 Mode]
|
||||
/***********************************************************************
|
||||
- Mode 0, 13-bit Counter/Timer
|
||||
- Mode 2, 8-bit Counter/Timer with Auto-Reload
|
||||
- Timer Mode
|
||||
- Timer 0 enabled when TR0 = 1 irrespective of INT0 logic level
|
||||
- Timer Mode
|
||||
- Timer 1 enabled when TR1 = 1 irrespective of INT1 logic level
|
||||
***********************************************************************/
|
||||
TMOD = TMOD_T0M__MODE0 | TMOD_T1M__MODE2 | TMOD_CT0__TIMER
|
||||
| TMOD_GATE0__DISABLED | TMOD_CT1__TIMER | TMOD_GATE1__DISABLED;
|
||||
// [TMOD - Timer 0/1 Mode]$
|
||||
|
||||
// $[TCON - Timer 0/1 Control]
|
||||
/***********************************************************************
|
||||
- Start Timer 1 running
|
||||
***********************************************************************/
|
||||
TCON |= TCON_TR1__RUN;
|
||||
// [TCON - Timer 0/1 Control]$
|
||||
|
||||
}
|
||||
@ -196,10 +224,10 @@ extern void UARTE_1_enter_DefaultMode_from_RESET(void) {
|
||||
// $[SBCON1 - UART1 Baud Rate Generator Control]
|
||||
/***********************************************************************
|
||||
- Enable the baud rate generator
|
||||
- Prescaler = 1
|
||||
- Prescaler = 8
|
||||
***********************************************************************/
|
||||
SFRPAGE = 0x20;
|
||||
SBCON1 = SBCON1_BREN__ENABLED | SBCON1_BPS__DIV_BY_1;
|
||||
SBCON1 = SBCON1_BREN__ENABLED | SBCON1_BPS__DIV_BY_8;
|
||||
// [SBCON1 - UART1 Baud Rate Generator Control]$
|
||||
|
||||
// $[SMOD1 - UART1 Mode]
|
||||
@ -217,9 +245,9 @@ extern void UARTE_1_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
// $[SBRLL1 - UART1 Baud Rate Generator Low Byte]
|
||||
/***********************************************************************
|
||||
- UART1 Baud Rate Reload Low = 0x30
|
||||
- UART1 Baud Rate Reload Low = 0xE6
|
||||
***********************************************************************/
|
||||
SBRLL1 = (0x30 << SBRLL1_BRL__SHIFT);
|
||||
SBRLL1 = (0xE6 << SBRLL1_BRL__SHIFT);
|
||||
// [SBRLL1 - UART1 Baud Rate Generator Low Byte]$
|
||||
|
||||
// $[UART1LIN - UART1 LIN Configuration]
|
||||
@ -336,12 +364,12 @@ extern void PORTS_0_enter_DefaultMode_from_RESET(void) {
|
||||
- P0.4 output is push-pull
|
||||
- P0.5 output is open-drain
|
||||
- P0.6 output is open-drain
|
||||
- P0.7 output is open-drain
|
||||
- P0.7 output is push-pull
|
||||
***********************************************************************/
|
||||
P0MDOUT = P0MDOUT_B0__OPEN_DRAIN | P0MDOUT_B1__OPEN_DRAIN
|
||||
| P0MDOUT_B2__OPEN_DRAIN | P0MDOUT_B3__OPEN_DRAIN
|
||||
| P0MDOUT_B4__PUSH_PULL | P0MDOUT_B5__OPEN_DRAIN
|
||||
| P0MDOUT_B6__OPEN_DRAIN | P0MDOUT_B7__OPEN_DRAIN;
|
||||
| P0MDOUT_B6__OPEN_DRAIN | P0MDOUT_B7__PUSH_PULL;
|
||||
// [P0MDOUT - Port 0 Output Mode]$
|
||||
|
||||
// $[P0MDIN - Port 0 Input Mode]
|
||||
@ -411,6 +439,13 @@ extern void PORTS_1_enter_DefaultMode_from_RESET(void) {
|
||||
extern void PORTS_2_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
// $[P2 - Port 2 Pin Latch]
|
||||
/***********************************************************************
|
||||
- P2.0 is low. Set P2.0 to drive low
|
||||
- P2.1 is high. Set P2.1 to drive or float high
|
||||
- P2.2 is high. Set P2.2 to drive or float high
|
||||
- P2.3 is high. Set P2.3 to drive or float high
|
||||
***********************************************************************/
|
||||
P2 = P2_B0__LOW | P2_B1__HIGH | P2_B2__HIGH | P2_B3__HIGH;
|
||||
// [P2 - Port 2 Pin Latch]$
|
||||
|
||||
// $[P2MDOUT - Port 2 Output Mode]
|
||||
@ -438,3 +473,75 @@ extern void PORTS_2_enter_DefaultMode_from_RESET(void) {
|
||||
|
||||
}
|
||||
|
||||
extern void TIMER01_0_enter_DefaultMode_from_RESET(void) {
|
||||
// $[Timer Initialization]
|
||||
//Save Timer Configuration
|
||||
uint8_t TCON_save;
|
||||
TCON_save = TCON;
|
||||
//Stop Timers
|
||||
TCON &= ~TCON_TR0__BMASK & ~TCON_TR1__BMASK;
|
||||
|
||||
// [Timer Initialization]$
|
||||
|
||||
// $[TH0 - Timer 0 High Byte]
|
||||
// [TH0 - Timer 0 High Byte]$
|
||||
|
||||
// $[TL0 - Timer 0 Low Byte]
|
||||
// [TL0 - Timer 0 Low Byte]$
|
||||
|
||||
// $[TH1 - Timer 1 High Byte]
|
||||
/***********************************************************************
|
||||
- Timer 1 High Byte = 0x30
|
||||
***********************************************************************/
|
||||
TH1 = (0x30 << TH1_TH1__SHIFT);
|
||||
// [TH1 - Timer 1 High Byte]$
|
||||
|
||||
// $[TL1 - Timer 1 Low Byte]
|
||||
// [TL1 - Timer 1 Low Byte]$
|
||||
|
||||
// $[Timer Restoration]
|
||||
//Restore Timer Configuration
|
||||
TCON |= (TCON_save & TCON_TR0__BMASK) | (TCON_save & TCON_TR1__BMASK);
|
||||
|
||||
// [Timer Restoration]$
|
||||
|
||||
}
|
||||
|
||||
extern void UART_0_enter_DefaultMode_from_RESET(void) {
|
||||
// $[SCON0 - UART0 Serial Port Control]
|
||||
/***********************************************************************
|
||||
- UART0 reception enabled
|
||||
***********************************************************************/
|
||||
SCON0 |= SCON0_REN__RECEIVE_ENABLED;
|
||||
// [SCON0 - UART0 Serial Port Control]$
|
||||
|
||||
}
|
||||
|
||||
extern void SPI_0_enter_DefaultMode_from_RESET(void) {
|
||||
// $[SPI0CKR - SPI0 Clock Rate]
|
||||
/***********************************************************************
|
||||
- SPI0 Clock Rate = 0x17
|
||||
***********************************************************************/
|
||||
SPI0CKR = (0x17 << SPI0CKR_SPI0CKR__SHIFT);
|
||||
// [SPI0CKR - SPI0 Clock Rate]$
|
||||
|
||||
// $[SPI0FCN0 - SPI0 FIFO Control 0]
|
||||
// [SPI0FCN0 - SPI0 FIFO Control 0]$
|
||||
|
||||
// $[SPI0FCN1 - SPI0 FIFO Control 1]
|
||||
// [SPI0FCN1 - SPI0 FIFO Control 1]$
|
||||
|
||||
// $[SPI0CFG - SPI0 Configuration]
|
||||
// [SPI0CFG - SPI0 Configuration]$
|
||||
|
||||
// $[SPI0CN0 - SPI0 Control]
|
||||
/***********************************************************************
|
||||
- Enable the SPI module
|
||||
- 3-Wire Slave or 3-Wire Master Mode
|
||||
***********************************************************************/
|
||||
SPI0CN0 &= ~SPI0CN0_NSSMD__FMASK;
|
||||
SPI0CN0 |= SPI0CN0_SPIEN__ENABLED;
|
||||
// [SPI0CN0 - SPI0 Control]$
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <SI_EFM8UB1_Register_Enums.h>
|
||||
#include <efm8_usb.h>
|
||||
#include <stdio.h>
|
||||
#include "printing.h"
|
||||
#include "descriptors.h"
|
||||
|
||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||
@ -126,7 +127,6 @@ USB_Status_TypeDef USBD_SetupCmdCb(
|
||||
|
||||
|
||||
|
||||
uint8_t hidmsgbuf[64];
|
||||
uint16_t USBD_XferCompleteCb(uint8_t epAddr, USB_Status_TypeDef status,
|
||||
uint16_t xferred, uint16_t remaining ) {
|
||||
|
||||
@ -134,10 +134,9 @@ uint16_t USBD_XferCompleteCb(uint8_t epAddr, USB_Status_TypeDef status,
|
||||
UNUSED(xferred);
|
||||
UNUSED(remaining);
|
||||
|
||||
|
||||
if (epAddr == EP1OUT)
|
||||
{
|
||||
// set_app_u2f_hid_msg((struct u2f_hid_msg *) hidmsgbuf );
|
||||
usb_transfer_complete();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,17 +1,87 @@
|
||||
#include <SI_EFM8UB1_Register_Enums.h>
|
||||
#include "InitDevice.h"
|
||||
#include "efm8_usb.h"
|
||||
#include "uart_1.h"
|
||||
#include "printing.h"
|
||||
|
||||
#define BUFFER_SIZE 10
|
||||
|
||||
uint8_t write_ptr = 0;
|
||||
uint8_t read_ptr = 0;
|
||||
uint8_t count = 0;
|
||||
|
||||
uint8_t hidmsgbuf[64][BUFFER_SIZE];
|
||||
|
||||
void usb_transfer_complete()
|
||||
{
|
||||
count++;
|
||||
write_ptr++;
|
||||
if (write_ptr == BUFFER_SIZE)
|
||||
{
|
||||
write_ptr = 0;
|
||||
}
|
||||
cprints("read hid msg\r\n");
|
||||
}
|
||||
|
||||
void spi_transfer_complete()
|
||||
{
|
||||
count--;
|
||||
read_ptr++;
|
||||
if (read_ptr == BUFFER_SIZE)
|
||||
{
|
||||
read_ptr = 0;
|
||||
}
|
||||
cprints("sent hid msg\r\n");
|
||||
}
|
||||
|
||||
SI_INTERRUPT (SPI0_ISR, SPI0_IRQn)
|
||||
{
|
||||
|
||||
static unsigned char command;
|
||||
static unsigned char array_index = 0;
|
||||
static unsigned char state = 0;
|
||||
char arr[2];
|
||||
|
||||
if (SPI0CN0_WCOL == 1)
|
||||
{
|
||||
// Write collision occurred
|
||||
SPI0CN0_WCOL = 0; // Clear the Write collision flag
|
||||
}
|
||||
else if(SPI0CN0_RXOVRN == 1)
|
||||
{
|
||||
// Receive overrun occurred
|
||||
SPI0CN0_RXOVRN = 0; // Clear the Receive Overrun flag
|
||||
}
|
||||
else
|
||||
{
|
||||
// SPI0CN0_SPIF caused the interrupt
|
||||
|
||||
arr[0] = SPI0DAT; // Read the command
|
||||
arr[1] = 0;
|
||||
|
||||
cprints("got data: ");
|
||||
cprints(arr);
|
||||
cprints("\n\r");
|
||||
|
||||
|
||||
|
||||
SPI0CN0_SPIF = 0; // Clear the SPIF0 flag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(void) {
|
||||
volatile int xdata i,j,k;
|
||||
uint8_t lastcount = count;
|
||||
enter_DefaultMode_from_RESET();
|
||||
|
||||
IE_EA = 1;
|
||||
SCON0_TI = 1;
|
||||
P2_B0 = 1;
|
||||
cprints("hello,world\r\n");
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
k++;
|
||||
for (i = 0; i < 1000; i++)
|
||||
@ -23,6 +93,22 @@ int main(void) {
|
||||
P1_B4 = i&1;
|
||||
}
|
||||
P1_B5 = k&1;
|
||||
if (!USBD_EpIsBusy(EP1OUT) && !USBD_EpIsBusy(EP1IN))
|
||||
{
|
||||
if (count == BUFFER_SIZE)
|
||||
{
|
||||
cprints("Warning, USB buffer full\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
USBD_Read(EP1OUT, hidmsgbuf[write_ptr], 64, true);
|
||||
}
|
||||
}
|
||||
if (count != lastcount)
|
||||
{
|
||||
cprints("+1 to count \r\n");
|
||||
lastcount = count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,12 @@
|
||||
void putf(char c)
|
||||
{
|
||||
uint8_t i;
|
||||
SBUF1 = c;
|
||||
SBUF0 = c;
|
||||
// Blocking delay that works for 115200 baud on this device (<1ms)
|
||||
for (i=0; i<200; i++){}
|
||||
for (i=0; i<200; i++){}
|
||||
for (i=0; i<190; i++){}
|
||||
watchdog();
|
||||
// watchdog();
|
||||
}
|
||||
|
||||
|
||||
|
@ -553,7 +553,7 @@ if __name__ == '__main__':
|
||||
t.find_device()
|
||||
#t.test_hid()
|
||||
#t.test_fido2()
|
||||
t.test_fido2_simple()
|
||||
#t.test_fido2_simple()
|
||||
#t.test_fido2_brute_force()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user