Serial Pins PC2, PC1 problem Attiny 1626 #972
Replies: 3 comments
-
Nothing has changed relating to swap in theory. In practice, in the eons since 2.3.2, the serial class has twice undergone major remodeling which resulted in performance, greatly expanded features (there are now ways to expose virtually every hardware feature of the serial ports! (the only ones not supported now are IRCOM for purposes other than using the event input for RX instead of the pin (IRDA has been dead for decades, if it ever was alive at all, 9-bit serial (we all know how to implement it, but it would impose massive overhead on everyone, when Arduino has gotten by for it's entire existence without supporting that, even thought the option was always there, and MPCM (which is there for backwars compatbility with the same feature that as been on all AVRs since time immemorable, and which has always looked like a dumb feature. EVSYS RX input may work but I have not characterized it's behavior - it may or may not be limited to 115200 baud Improvements and flash savings, several major bugs in serial including swap have been fixed. For reasons unclear to me, you also picked a version in between the current version which does not have any known serious bugs, and the original version you used - but you picked an early 2.5.x version, and all the 2.5.x versions were known or suspected to have serial-related bugs, as the Serial improvements were extremely tricky and complex, involving 3 naked ISRs per serial port plus 3 shared blocks of hand optimized assembly called by those. Serial1.swap(1) will move Serial 1 from PA1/PA2 to PC2/PC1 Serial1 cannot use PB3/PB2 - this is a limitation of the hardware., Serial1 has only 2 options, and this is not one of them. Serial1 and Serial, if both set to use PA2/PA1, should not be expected to work correctly. HOWEVER, let me direct your attention to the changelog. 2.5.4 is old. There have been about a dozen releases since then, and about as many bugfixes marked "CRITICAL", and many changes and bugfixes that are related to serial communications. We only provide support for the latest version of the core. Also the 2.5.x versions are known to be have had oodles of bugs related to attachInterrupt and serial, because of a massive refactoring to reduce flash use and improve performance, particularly when using multiple serial ports, an early 2.6.x version introduced another major reduction in the size of the compiled binaries that made use of serial. 2.3.2 is just plain ancient. And the subsequent version fixed a bug with Serial.swap() - It is possible that you had written code that somehow worked around issue #470 - but now tat workaround is getting in the way of functioning. So the version you say worked could not have possibly worked without some sketchy workaround somewhere in your code - whatever hack you found to swap Serial1 to the alt pins should be removed, as it likely interferes with the correctly functioning swap().AND on top of that, the version you have upgraded to is known to have muiltiple bugs impacting serial. Please update to the latest core version which should fix those issues and further reduce the size of the binary, and retest. If Serial1.swap(1) does not move Serial1 from PA1/2 to PC2/1, please open an issue as that is a critical bug. If the issue does not reproduce in 2.6.8, it was one of the MANY things that were fixed since then. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. As I did a long time ago on 2.3.2 I used something like this and it used to work. PORTMUX.USARTROUTEA |= PORTMUX_USART1_ALT1_gc; |
Beta Was this translation helpful? Give feedback.
-
If you ever need to set the portmux manuallyright before serialswap like that - that's definitely a bug, that's what swap is supposed to do for you |
Beta Was this translation helpful? Give feedback.
-
Hi guys
how to use serial pins PC2, PC1.
When I used version 2.3.2 using swap, everything worked for me. Now I have version 2.5.4 because older programs work on it, I don't want to change it, I just have a problem with Serial. I can't change the pins because I still have a lot of pcb that I made once.
please help me how to run this Serial I tried and nothing the radio system does not work.
Beta Was this translation helpful? Give feedback.
All reactions