If I try to run it with PB0 as RX it doesn't work at all.
And I have tried various RX pins under PBx and PCx port, it's the same problem. Only PDx works as RX like a charm.
Is there a known restriction or something to do fix this problem ?
Why not use the recommended pin numbers (PORTD bit7 is pin 7, PORT B bit 0 is pin 8 )?
The SoftwareSerial tutorial uses 10,11; those are PORTB bits 2,3.
which puts the Rx line on D7, and the Tx line on D1.
The PDx and PBx notation defines the bit position within Port D and Port B, respectively. For most sketches, you would use 0 through 13 to specify ports D0 through D13, and A0 through A7 for the nano analog ports (although 0 through 7 will work for analogRead instructions, since it can be assumed the reference is to an analog input).
PortD0 to D7 are D0 to D7
PortB0 to B5 are D8 to D13
PortC0 to C5 are D14 to D19.
A Nano and some Prominis will have C6 and C7 as Analog6 and Analog7. (input only)
D0/D1 are the hardware UART pins that connect back to the PC for serial downloads/serial prints.
Don't use D0/D1 for software serial.
As I came from the AVR world, that's maybe my second design with the Arduino's IDE, I've made a mistake with naming the I/O pins as I used to do: PBx etc.
I've downloaded a ref card "NANO PINOUT" and understood the mapping:
D0-D7 are pins 0 to 7 and are mapped to PD0-PD7
D8-D13 are pins 8 to 13 and are mapped to PB0-PB5
A0-A5 are pins 14 to 19 and are mapped to PC0-PC5
So, this evening I'll try to use "8" instead of PB0 and so, then I'll let you know if it rocks.
As I came from the AVR world, that's maybe my second design with the Arduino's IDE, I've made a mistake with naming the I/O pins as I used to do: PBx etc.
I've downloaded a ref card "NANO PINOUT" and understood the mapping:
D0-D7 are pins 0 to 7 and are mapped to PD0-PD7
D8-D13 are pins 8 to 13 and are mapped to PB0-PB5
A0-A5 are pins 14 to 19 and are mapped to PC0-PC5
So, this evening I'll try to use "8" instead of PB0 and so, then I'll let you know if it rocks.
Yes, the Arduino functions take the Arduino Pin Numbers (0-19 or thereabouts, for a Nano.)
The various PDn and PBn definitions still exist via <avr/io.h> (that the Arduino Core includes for you), and they're both integers, so the core can't detect mis-use. But PD0..PD7 is just 0..7 and PB0..PB7 is ALSO 0..7, so the only reason it's working on PDn for you is that the Pin numbers and the PD values just happen to be the same. (that won't be true on some other boards!)
So, with the correct naming, 8 for pin D8 it works like a charm.
And I've tried with 13, the built-in LED, it works fine too, no restriction on this pin.