I need the bootloader for the R4 Minima modified. I am using P003 and P004 for A6 and A7, but it seems the bootloader is preventing it. I am not using D21/22 for RX/TX LEDs - they are gone. If someone is able to create a custom bootloader, based on the R4 Minima bootloader, please let me know.
I am not asking for ideas like adding external A/D converter. I got a clear description about what I am looking for, and I am not looking for something else.
Because configuring them doesn't seem to work. I modified the arduino_pins.h and the variant.cpp to add these 2 ports but I still can't read analog values connected to them. Both pins deliver floating values between 680 and 730, regardless if grounded or pulled high. Therefore, I am expecting the bootloader to be the part that doesn't let me access these pins. If you know it better, please tell me how to achieve it.
I'm not familiar with your board and hence can't help but usually boot loaders are only active at boot time and hand control over to the loaded sketch.
It would be great if you could tell me what I need to change. I took the R4 Minima board manager files and modified them (only modifications shown):
arduino_pins.h: #define NUM_ANALOG_INPUTS (8u) // Include A6 and A7 #define PIN_A6 (20u) // Set A6 to the correct pin number #define PIN_A7 (21u) // Set A7 to the correct pin number
static const uint8_t A6 = PIN_A6; // Make A6 accessible for analogRead()
static const uint8_t A7 = PIN_A7; // Make A7 accessible for analogRead()
From the uploaded code. The processor on your board uses native USB (look at the schematic). The executable that is uploaded contains what you have written plus some additional stuff to provide functionality for the communication over USB, board identification and reaction of the software reset issued by the IDE (opening and closing serial port with a baudrate of 1200 baud). That functionality will also involve the blinking of the Rx and Tx LEDs (P013 and P012 if I look at the schematic).
The uploaded code will, under normal circumstances, blink those LEDs when you receive or send data; there is no bootloader involved. The bootloader will also blink those LEDs when it is active and receiving/sending data; it has it's own functionality for that.
Note that I stated that I'm not familiar with your board; this also means that I don't have one so I can not test it's behaviour.
Okay. I thought this "additional stuff" is part of the bootloader code. I didn't expect it to be part of the payload sent to the MCU any time a program is flashed to it.
You don't need to worry about my circuit. The only question was: How to make the 2 analog inputs useable in the Arduino IDE. And since one of them is used to light a status LED (for serial connection), how to remove this unnecessary function from the GPIO.
The question remains unanswered.
Please, if someone can help me, I would very much appreciate it. Because this is beyond my knowledge and experience, but I need to resolve this problem.
Okay, I missed the PmnPFS registers part. And I found out that the RX and TX LEDs are connected to other pins, after looking at the Minima schematics. No idea why I thought they would use one of the 2 ports I need for analog inputs. Therefore, the part of my question regarding the UART LEDs is obsolete.
Regardless, I am done here. I am not arguing with "I-know-everything-you-know nothing" smarty pants.