Problem Driving UART0 In Combination With The ACT LED - Raspberry Pi Forums


hello.

have modified program based on bakingpi ok03 code add sending of character through uart0 each time act led switched on or switched off.

issue have order of accessing gpio i/o pin led , accessing uart0 seems important (which not expectation). have attached source main loop. supplied, flashes act led , sends '121212...' uart (which can see in putty). seems fine.

if uncomment lines mentioned in source, led switched on , '1' set uart0; led switched off , '2' sent uart0 - , that's it. no more flashing , seemingly no more characters sent uart0 (nothing shown in putty).

using data memory barriers on entry , exit setgpiofunction, inituart0, putchar , setgpio, wit:

mcr p15, 0, ip, c7, c10, 5

(my knowledge of dmbs sketchy @ best.)

have suggestions might going on?

regards

nick

code: select all

                .section    .text main:                 mov     sp, #0x8000   pinnum          .req    r0 pinfunc         .req    r1                 mov     pinnum, #16                 mov     pinfunc, #1                 bl      setgpiofunction             // set gpio pin                  .unreq  pinnum                 .unreq  pinfunc                  bl      inituart0                   // initialise uart0  main_loop:  pinnum          .req    r0                          // turn on led pinval          .req    r1                 mov     pinnum, #16                 mov     pinval, #0                 bl      setgpio                  .unreq  pinnum                 .unreq  pinval                  mov     r0, #'1'                    // send '1' through uart0                 bl      putchar                  bl      delay                  mov     r0, #'2'                    // send '2' through uart0                 bl      putchar  pinnum          .req    r0                          // turn off led pinval          .req    r1                 mov     pinnum, #16                 mov     pinval, #1                 bl      setgpio                  .unreq  pinnum                 .unreq  pinval  // if following 2 lines uncommented, led never switched on again, // , seemingly no more characters sent through uart0 (including '3').  //                mov     r0, #'3'                    // send '3' through uart0 //                bl      putchar                  bl      delay  loop:           b       main_loop 

update: if add delay before sending of '3' uart0, program works fine

code: select all

                bl      delay                  mov     r0, #'3'                    // send '3' through uart0                 bl      putchar 
looks though i'm not waiting long enough after doing gpio pin manipulation before accessing uart0.

there way of checking gpio ready before writing again?


raspberrypi



Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial