TriodeGirl / Arduino-UNO-R4-code-DAC-ADC-Ints-Fast_Pins

Direct register setup of ADC and DAC, with fast non-blocking ADC with ADC_Complete Interrupt
GNU General Public License v3.0
3 stars 1 forks source link

Unable to change digital output on D5, D4 etc ports #1

Open iamritpal opened 1 week ago

iamritpal commented 1 week ago

I was unable to change output on D5, D4 etc ports.

#define PFS_P100PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843))   // 8 bits - A5
#define PFS_P101PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 1 * 4))) // A4
#define PFS_P102PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 2 * 4))) // D5
#define PFS_P103PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 3 * 4))) // D4
#define PFS_P104PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 4 * 4))) // D3
#define PFS_P105PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 5 * 4))) // D2
#define PFS_P106PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 6 * 4))) // D6
#define PFS_P107PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 7 * 4))) // D7
#define PFS_P108PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 8 * 4))) // SWDIO
#define PFS_P109PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + ( 9 * 4))) // D11 / MOSI
#define PFS_P110PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + (10 * 4))) // D12 / MISO
#define PFS_P111PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + (11 * 4))) // D13 / SCLK
#define PFS_P112PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0843 + (12 * 4))) // D10 / CS

I was able to change and observe using analyzer on the following digital ports:

#define PFS_P300PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x08C3))            // SWCLK (P300)
#define PFS_P301PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x08C3 + (01 * 4))) // D0 / RxD (P301)
#define PFS_P302PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x08C3 + (02 * 4))) // D1 / TxD (P302) 
#define PFS_P303PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x08C3 + (03 * 4))) // D9
#define PFS_P304PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x08C3 + (04 * 4))) // D8

I think it has do with incorrect offset 0x0843 for the not working digital outputs. Were you able to test those not working outputs?

iamritpal commented 1 week ago

I figured out my issue. The problem is that you have defined pin locations for arduino uno R4. https://docs.arduino.cc/resources/schematics/ABX00080-schematics.pdf

But I am using arduino uno R4 wifi. https://docs.arduino.cc/resources/schematics/ABX00087-schematics.pdf

TriodeGirl commented 4 days ago

Hi, Sorry for the delay in replying, I have been very busy with work overruns and not had time to deal with my personal emails for the last few days. Yes, the WiFi has a whole lot of different pin assignments! The latest version of my R4 Minima #defines is now posted separately: https://github.com/TriodeGirl/RA4M1_Arduino_UNO-R4_Processor_Direct_Register_Addressing_Defines Thanks. Best, Susan.