ULP GPIO access?

kbaud1
Posts: 71
Joined: Wed Jan 17, 2018 11:55 pm

ULP GPIO access?

Postby kbaud1 » Thu Mar 01, 2018 3:03 am

This is running on the devkitc (wroom daughterboard).

The files can be put in place of the files in the "ulp-example" project found online and built/flashed. (The files have the same names as the files they replace.)

Code: Select all

#include "soc/rtc_cntl_reg.h"
#include "soc/rtc_io_reg.h"
#include "soc/soc_ulp.h"

	.bss
	.global reading
reading:
	.long 0

	.text
	.global entry
entry:
	READ_RTC_FIELD (RTC_GPIO_IN_REG, RTC_GPIO_IN_NEXT)	// r0 = lower 16 RTC IOs
	move r1, reading									// r1 = &reading
	st r0, r1, 0										// reading = r0
	jump entry


// The macro READ_RTC_FIELD above compiles to:
//	REG_RD (RTC_GPIO_IN_REG - DR_REG_RTCCNTL_BASE) / 4, RTC_GPIO_IN_NEXT_S + 15, RTC_GPIO_IN_NEXT_S
See attachement for the ulp_example_main.c file. (files with .S extensions cannot be attached)

When this program is run (via make monitor), it shows 16-bits of readings from the GPIO pins supposedly accessible to the ULP. You have to feed some kind of signal into the pins to test them, at which time you can see the bits change on the screen corresponding to the pins you drive.

• RTC bits 1 and 2 are inaccessible on the daughter board.
• RTC bits 0 and3-9 do not work at all from the ULP (as inputs or outputs).
• RTC bits 10-15 do work from the ULP (as inputs or outputs).
• RTC bit 11 (GPIO0) seems to have a 2.2K pullup resistor attached to it that I can't figure out how to disable in the software.
• RTC bit 16 works as an output, but I can't figure out how to read it as an input (this will probably not be needed)
• RTC bit 17 does not work as an output, and I can't figure out how to read it as an input (this will probably not be needed)

All the above GPIO pins work as described in the documentation (RTC bits 0-5 are simple input only) when accessed from the main CPU. However, GPIO0 has the pullup resistor that I can't figure out how to disable from the main CPU either.
Attachments
ulp_example_main.c
(1.13 KiB) Downloaded 936 times

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ULP GPIO access?

Postby WiFive » Thu Mar 01, 2018 3:15 am

I don't see rtc_gpio_init in your loop

Who is online

Users browsing this forum: No registered users and 83 guests