I reiterate my post, perhaps it is appeared in a wrong place.
Big problem if I use the pin #define in samd21g18a.h file!
The only way to have a working pin #define if I want to use the shield connector pins
A0..A6, D5 (marked as -5 on the connector)
is the following:
#define SCLK A0 // pin A0 on the connector
#define SDATA_IN_TO_FPGA A1 // pin A1 on the connector
#define SDATA_OUT_TO_PROC A2 // pin A2 on the connector
#define READ_FROM_FPGA A3 // pin A3 on the connector
#define WRITE_TO_FPGA_ENABLE A4 // pin A4 on the connector
#define TRIGGER A5 // pin A5 on the connector
#define TRIGGER_RESET A6 // pin A6 on the connector
#define globalReset 5 // pin -5 on the connector
Using tha above defines I can operate and check by an oscilloscope
each pin, setting it to 1 and to 0.
If I use the defines from samd21g18a.h file, looking at the schematic
#define SCLK 2 // pin A0 on the connector, PIN_PA02
#define SDATA_IN_TO_FPGA 34 // pin A1 on the connector, PIN_PB02
#define SDATA_OUT_TO_PROC 35 // pin A2 on the connector, PIN_PB03
#define READ_FROM_FPGA 4 // pin A3 on the connector, PIN_PA04
#define WRITE_TO_FPGA_ENABLE 5 // pin A4 on the connector, PIN_PA05
#define TRIGGER 6 // pin A5 on the connector, PIN_PA06
#define TRIGGER_RESET 7 // pin A6 on the connector, PIN_PA07
#define globalReset 43 // pin -5 on the connector, PIN_PB11
So, what are the "magic" numbers of the working defines?
(decimal values)
A0 = 15
A1 = 16
A2 = 17
A3 = 18
A4 = 19
A5 = 20
A6 = 21
As bonus the LED_BUILTIN that should be attached to processor
PB08 --> #define PIN_PB08 40 /**< \brief Pin Number for PB08 */
but results to be defined as 32
LED_BUILTIN = 32
With the defines from samd21g18a.h file,
after the program upload the usb communication with MKRVidor4000 doesn't work
anymore, for successive programming and with my terminal emulator.
I can see the usual USB COM port comes up after boot but:
- the terminal emulator hangs at startup and doesn' open its window
- If I want to upload another program, first I have to reprogram the bootloader
using the onboard reset button double-click
Maybe I'm wrong, so I ask here is someone of you has developed a program using the
shield pins and how he has defined the pins.