Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using portOutputRegister will throw an exception. #1110

Closed
svaygame opened this issue Nov 29, 2015 · 0 comments
Closed

When using portOutputRegister will throw an exception. #1110

svaygame opened this issue Nov 29, 2015 · 0 comments
Milestone

Comments

@svaygame
Copy link

When using portOutputRegister will throw an exception.

Example project: adafruit-ssd1331

I found some issue at address operations

//Incorrect !! ,  the return value is not a valid address. Type of GPO is uint32_t , not an address pointer
#define portOutputRegister(port)    ((volatile uint32_t*) GPO)
//Correct , return the address of GPO  ,  
#define portOutputRegister(port)    ((volatile uint32_t*) &GPO)

reference:

https://github.com/esp8266/Arduino/blob/master/cores/esp8266/esp8266_peri.h

#define ESP8266_REG(addr) *((volatile uint32_t *)(0x60000000+(addr)))
...
#define GPO    ESP8266_REG(0x300) //GPIO_OUT R/W (Output Level)
#define GPE    ESP8266_REG(0x30C) //GPIO_ENABLE R/W (Enable)
#define GPI    ESP8266_REG(0x318) //GPIO_IN RO (Read Input Level)

https://github.com/esp8266/Arduino/blob/master/cores/esp8266/Arduino.h

#define portOutputRegister(port)    ((volatile uint32_t*) GPO)
#define portInputRegister(port)     ((volatile uint32_t*) GPI)
#define portModeRegister(port)      ((volatile uint32_t*) GPE)
@igrr igrr added this to the 2.1.0 milestone Nov 30, 2015
acropup added a commit to acropup/Encoder that referenced this issue Jan 14, 2016
Added definitions, and workaround for current v2.0.0 of ESP8266 Arduino.
Includes instruction on removing the workaround once v2.1.0 is released
and this bug is fixed:
esp8266/Arduino#1110
@igrr igrr closed this as completed Feb 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants