Go Down

Topic: Reading extra GPIO pins in Port E (328PB) (Read 228 times) previous topic - next topic

mikeymikey

Hello,
My senior design team and I are using the new 328-PB chip on our custom PCB. We have broken out some of the additional pins the PB offers over the old 328-P.... Unfortunately we don't know how to access these pins as we don't know that the arduino IDE recognizes them.

We are using tinyISP to program along with Watterott's opitboot configuration.
https://github.com/watterott/ATmega328PB-Testing

Maybe we can just define our pins as 20-23 and the IDE will recognize them as just regular pins?


Point being as a sanity check I tried accessing digital pin 9 on a 2560 with #define ledPin PH6...and it did not work (compiled/uploaded fine), but #define ledPin 9 does.   I guess the AVR designations don't work in arduino.

Any advice would be appreciated!


Coding Badly


An option...
https://www.google.com/search?q=arduino+direct+port

The other option is to create your own (or use an existing) board definition for that processor.



DrAzzy

At this point MiniCore (by MCUdude/hansibul) is a better bet for the PB series.

I think it provides pin numbers for the new pins, so you can use them with digitalWrite() and the like.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

hansibull

Yes, MiniCore is probably the best option for 328PB support.

MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

mikeymikey

#4
Jul 10, 2018, 12:27 am Last Edit: Jul 10, 2018, 12:30 am by mikeymikey
An option...
https://www.google.com/search?q=arduino+direct+port

The other option is to create your own (or use an existing) board definition for that processor.



The tutorials I have been finding seem to be trying to use direct mapping to effect rapid bit flipping to produce output... Haven't seen anybody desire to manually read pin input this way... no real advantage... would break cross compatibility. We are unique in our needs as our board is custom.


I will look into the mini core fork. It seems very well documented.


If I can make my own board definition.. can't I just look at watterott's and determine what they named the E pins as?
Where would I find the board configs?

hansibull

Quote
The tutorials I have been finding seem to be trying to use direct mapping to effect rapid bit flipping to produce output... Haven't seen anybody desire to manually read pin input this way... no real advantage... would break cross compatibility. We are unique in our needs as our board is custom.
Reading a port state by using the PINx register (PINE in your case) is definitly the fastest way to read a pin in terms of clock cycles. That's one real advantage right there. if you want to read the other ports one the 328PB you simply just use PINB, PINC or PIND. Reading these registers will for ATmega328 (and infact all MiniCore compatible microcontrollers) without any changes in hardware or software. I'd say it's pretty cross compatible across the whole range (ATmega8/48/88/168/328/328PB).

Quote
If I can make my own board definition.. can't I just look at watterott's and determine what they named the E pins as?
Where would I find the board configs?
Why would you want to do this? If you're worried about compatibility you should definitly stick to a pinout that's widely used and accepted. If you look at the pinout pic I posted you can clearly see what "Arduino pin" are mapped to PORTE.
MightyCore -  ATmega1284, mega644, mega324, mega164, mega32, mega16, mega8535
Github.com/MCUdude/MightyCore

MiniCore - ATmega8, mega48, mega88, mega168, mega328
Github.com/MCUdude/MiniCore

Go Up