Chat freely about anything...

User avatar
By raz123
#19588 Objective

1. Test a GPIO pin.
2. Branch, accordingly, to either send a '0' or '1' character through UART0 (0x60000000)

Progress

Despite my knowledge of Motorola and AVR assembly, the last few hours have proved fruitless in reaching the objective on this Xtensa platform. At this point, I am extending my hand for tips and hints.

Gathered info

For the sake of an example, let us suppose that GPIO.12 is the pin that needs to be sampled.
Let us also suppose that the pin has been properly configured to act as an input.

We know that the GPIO pin values can be accessed at address 0x60000318.

Code: Select all0x60000318: AA BB CC DD
CC holds values of pin GPIO.15 to pin GPIO.08
DD holds values of pin GPIO.07 to pin GPIO.00


This is the point where things get fuzzy. Do I need to:

0. Store ascii 0 (0x30) and ascii 1 (0x31) into two registers (say, a1 and a2), using s32i?
1. Load all of 0x60000318 to a register (say, a3), using l32r?
2. Test the a3 register and branch accordingly, using bbsi?
3. Send a character by moving the right register (a1 or a2) to 0x60000000 (UART0), using mov?

Any pointer would be appreciated.
Last edited by raz123 on Fri Jun 05, 2015 2:31 pm, edited 2 times in total.
User avatar
By raz123
#19590
cal wrote:Does that provide inspiration:
https://github.com/nodemcu/nodemcu-firm ... platform.c


Hey Cal, thanks for the reply.

It looks like I have neglected to mention that I am aware of Espressif's API functions to read/write to GPIO/UART, along with other non-API functions that use the WRITE_PERI_REG function.

I'm really trying to understand how it could be done using assembly!