Hello,
I have a problem,i wrote this program but it dosen't work.
It doesn't read its rx pin.
Can you help me pls ???
CODS:
PUBLIC MAINTASK PUBLIC __vector_table SECTION .text:CODE:REORDER(10) ;; Keep vector table even if it's not referenced REQUIRE __vector_table THUMBBIT0 EQU 1 << 0BIT1 EQU 1 << 1BIT2 EQU 1 << 2BIT3 EQU 1 << 3BIT4 EQU 1 << 4BIT5 EQU 1 << 5BIT6 EQU 1 << 6BIT7 EQU 1 << 7BIT8 EQU 1 << 8BIT9 EQU 1 << 9BIT10 EQU 1 << 10BIT11 EQU 1 << 11BIT12 EQU 1 << 12BIT13 EQU 1 << 13BIT14 EQU 1 << 14BIT15 EQU 1 << 15BIT16 EQU 1 << 16BIT17 EQU 1 << 17BIT18 EQU 1 << 18BIT19 EQU 1 << 19BIT20 EQU 1 << 20BIT21 EQU 1 << 21BIT22 EQU 1 << 22BIT23 EQU 1 << 23BIT24 EQU 1 << 24BIT25 EQU 1 << 25BIT26 EQU 1 << 26BIT27 EQU 1 << 27BIT28 EQU 1 << 28BIT29 EQU 1 << 29BIT30 EQU 1 << 30BIT31 EQU 1 << 31
RCC_BASE EQU 0x40023800RCC_AHB1ENR EQU RCC_BASE + 0x30RCC_APB1ENR EQU RCC_BASE + 0x40RCC_CFGR EQU RCC_BASE + 0x08
GPIOD_BASE EQU 0x40020C00GPIOD_MODER EQU GPIOD_BASE + 0x00GPIOD_ODR EQU GPIOD_BASE + 0x14GPIOD_IDR EQU GPIOD_BASE + 0x10GPIOD_BSRR EQU GPIOD_BASE + 0x18GPIOD_AFRH EQU GPIOD_BASE + 0x24
USART_SR EQU GPIOD_BASE + 0x00USART_DR EQU GPIOD_BASE + 0x04USART_BRR EQU GPIOD_BASE + 0x08USART_CR1 EQU GPIOD_BASE + 0x0C
MAINTASK LDR R0, =RCC_AHB1ENR LDR R1, [R0] ORR R1,R1,#BIT3 STR R1, [R0]
LDR R0, =RCC_APB1ENR LDR R1,[R0] ORR R1,R1,#BIT18 str R1, [R0]
LDR R0, =GPIOD_MODER LDR R1, =(BIT0|BIT2|BIT4|BIT6|BIT8|BIT10|BIT17|BIT19) STR R1, [R0]
LDR R0, =USART_CR1 LDR R1, =(BIT13|BIT2|BIT3|BIT5) STR R1, [R0]
LDR R0, =USART_BRR LDR R1, =0x341 ; BRAUD RATE 9600 STR R1, [R0]
DATASTOCONTROL LDR R2, =0x31 ;1 signal LDR R3, =0x32 ;2 signal LDR R4, =0x33 ;3 signal LDR R5, =0x34 ;4 signal
CONTROLREAD
LDR R0, =USART_SR LDR R1, [R0] MOVS R0, #BIT5 TST R0, R1 BEQ CONTROLREAD
LDR R0, =USART_DR ; USART_DR(gelen veri) degerini R0'a yükle LDR R1, [R0] ; USART_DR registerini R1'ye kopyala
MOVE
CMP R1, R2 BEQ FORWARD CMP R1, R3 BEQ BACK CMP R1, R4 BEQ RIGHT CMP R1, R5 BEQ LEFT BL CONTROLREAD
FORWARD MOV R0,#0 MOV R1,#0 LDR R0,=GPIOD_ODR MOV R1,#(BIT0|BIT2|BIT8|BIT10) STR R1,[R0] BL CONTROLREAD
BACK MOV R0,#0 MOV R1,#0 LDR R0,=GPIOD_ODR MOV R1,#(BIT4|BIT6|BIT8|BIT10) STR R1,[R0] BL CONTROLREAD
RIGHT MOV R0,#0 MOV R1,#0 LDR R0,=GPIOD_ODR MOV R1,#(BIT0|BIT6|BIT8|BIT10) STR R1,[R0] BL CONTROLREAD
LEFT MOV R0,#0 MOV R1,#0 LDR R0,=GPIOD_ODR MOV R1,#(BIT2|BIT4|BIT8|BIT10) STR R1,[R0] BL CONTROLREAD
;; Forward declaration of sections.
SECTION CSTACK:DATA:NOROOT(10) SECTION .intvec:CODE:NOROOT(10) DATA
__vector_table DCD sfe(CSTACK) DCD MAINTASK
DCD NMI_Handler DCD HardFault_Handler DCD MemManage_Handler DCD BusFault_Handler DCD UsageFault_Handler DCD 0 DCD 0 DCD 0 DCD 0 DCD SVC_Handler DCD DebugMon_Handler DCD 0 DCD PendSV_Handler DCD SysTick_Handler
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Default interrupt handlers.;;
PUBWEAK NMI_Handler PUBWEAK HardFault_Handler PUBWEAK MemManage_Handler PUBWEAK BusFault_Handler PUBWEAK UsageFault_Handler PUBWEAK SVC_Handler PUBWEAK DebugMon_Handler PUBWEAK PendSV_Handler PUBWEAK SysTick_Handler
SECTION .text:CODE:REORDER:NOROOT(10) THUMB
NMI_HandlerHardFault_HandlerMemManage_HandlerBusFault_HandlerUsageFault_HandlerSVC_HandlerDebugMon_HandlerPendSV_HandlerSysTick_HandlerDefault_Handler__default_handler CALL_GRAPH_ROOT __default_handler, "interrupt" NOCALL __default_handler B __default_handler BL MAINTASK END
Have you done basics like blinking LEDs? yes, i do
Note that the USART has nothing to do with ARM - it is ST's proprietary IP - so you'd probably be better asking on the ST forum
You are right , i am sorry for that.