Hello,
Actually,because of some reason i could not use ADC pin(GPIO4).
If i want to map GPIO34 to GPIO4,is it possible?.
If any one can know about it,Please guide me that how can do port-mapping.
Thanks in advance,
Regards,
Kishan Patel.
Process of port mapping
Re: Process of port mapping
My loose thinking on this is that one should think of GPIO pins as immutable. GPIO pin X will ALWAYS be GPIO pin X. If your code is designed to access GPIO 4 ... think of that as accessing physical pin called GPIO 4 as opposed to any logical alternative. You can't "map" GPIO 5 (physical pin 5) to GPIO 4 (physical pin 4).
There are "logical" functions ... UART, SPI, I2C and others ... and some of them "can" be mapped to physical pins. For example ... if today you are using pin X for UART TX, then you can map UART TX to pin Y.
Going back to your question, I think what you are asking is "can I map the ADC logical channel found on GPIO4 to be accessed as the same logical channel on GPIO 34" ... and the answer to that appears to be no. While "some" functions can be mapped across different GPIO pins, this does not mean that ALL functions can be so mapped.
If we read here:
http://esp-idf.readthedocs.io/en/latest ... s/adc.html
We find that there are two ADC controllers (ADC1 and ADC2) and a total of 18 ADC channels.
If we look here:
https://github.com/espressif/esp-idf/bl ... /adc.h#L55
We find that GPIO4 is ... and always will be ... ADC2_CHANNEL_0. We can't map ADC2_CHANNEL_0 to a different pin. However, if we look further we see that ADC1_CHANNEL_6 is found on GPIO34. What this seems to tell me is that if you might be able to recode your application to work with ADC1_CHANNEL_6.
There are "logical" functions ... UART, SPI, I2C and others ... and some of them "can" be mapped to physical pins. For example ... if today you are using pin X for UART TX, then you can map UART TX to pin Y.
Going back to your question, I think what you are asking is "can I map the ADC logical channel found on GPIO4 to be accessed as the same logical channel on GPIO 34" ... and the answer to that appears to be no. While "some" functions can be mapped across different GPIO pins, this does not mean that ALL functions can be so mapped.
If we read here:
http://esp-idf.readthedocs.io/en/latest ... s/adc.html
We find that there are two ADC controllers (ADC1 and ADC2) and a total of 18 ADC channels.
If we look here:
https://github.com/espressif/esp-idf/bl ... /adc.h#L55
We find that GPIO4 is ... and always will be ... ADC2_CHANNEL_0. We can't map ADC2_CHANNEL_0 to a different pin. However, if we look further we see that ADC1_CHANNEL_6 is found on GPIO34. What this seems to tell me is that if you might be able to recode your application to work with ADC1_CHANNEL_6.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 45
- Joined: Wed Aug 30, 2017 4:56 am
Re: Process of port mapping
Thanks for valuable answer.
I can recode for different ADC pin.But issue is about physical connection.
I have physical pin is IO4,and i found that there are some restriction to use this pin.
So,i was thinking that use IO34 functionality with physical pin IO4.
Again Thanks.
I can recode for different ADC pin.But issue is about physical connection.
I have physical pin is IO4,and i found that there are some restriction to use this pin.
So,i was thinking that use IO34 functionality with physical pin IO4.
Again Thanks.
Who is online
Users browsing this forum: pacucha42 and 107 guests