Minimum initialization for a GPIO output pin

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Evnin'...

I am trying to do a simple GPIO initialization in assembler right after boot loader finishes...

.equPRT1_DR,0x40040100
.equPRT1_PC,0x40040108
.equPRT1_PC2,0x40040118
.equPRT1_MODE,0x00180000
.equPRT1_MODE2,0x00000040

@ Blue LED is connected to P1.6, active High

Init:

  ldr r0, =PRT1_PC

  ldr r1, =PRT1_MODE

  str r1, [r0]

  ldr r0, =PRT1_PC2

  ldr r1, =PRT1_MODE2

  str r1, [r0]

  ldr r0, =PRT1_DR

  movs r1, #64

  str r1, [r0]

But to no joy...blue LED is not lit on the CY8KIT-049-42xx board....

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Nobody initializes pins using assembler! Configure the pins at design-time or use C-language when reconfiguring at run-time is required.

What do you think they invented C for?

​Bob

0 Likes
Anonymous
Not applicable

You must be working for another semiconductor company to drive people away using Cypress controller 😉

Anyway....already works...

But I guess we need to go for another controller like Infineon or TI

0 Likes

... and you are sure that the above code will work without modification even when you switch from one PSoC to another? I do not understand why you are using assembly language. What are the benefits??

Bob

0 Likes