Closed ozzyman closed 2 years ago
OK, I have surprised myself, and located the problem. Index variable i does not get declared in the driver_init function if the MPG mode pin is not defined.
By changing:
// Pull down MPG mode pin until startup is completed.
**uint32_t i = 0;**
while(mpg_pin == NULL) {
if(inputpin[i].id == Input_ModeSelect) {
mpg_pin = &inputpin[i];
mpg_pin->bit = 1U << mpg_pin->pin;
PIO_Mode(mpg_pin->port, mpg_pin->bit, OUTPUT);
BITBAND_PERI(MPG_MODE_PORT->PIO_ODSR, MPG_MODE_PIN) = 0;
}
i++;
}
to: uint32_t i = 0;
// Pull down MPG mode pin until startup is completed.
while(mpg_pin == NULL) {
if(inputpin[i].id == Input_ModeSelect) {
mpg_pin = &inputpin[i];
mpg_pin->bit = 1U << mpg_pin->pin;
PIO_Mode(mpg_pin->port, mpg_pin->bit, OUTPUT);
BITBAND_PERI(MPG_MODE_PORT->PIO_ODSR, MPG_MODE_PIN) = 0;
}
i++;
}
I get it to compile.
I fixed this a few days ago but forgot to commit it as I have been busy with other issues. Will commit the fix later today.
Thanks, Terje.
I'm working up a machine map for RAMPS1.4 as well.
I have to confess that I am a complete bumblefuck when it comes to C code, but I can't get the SAM3X38 driver to compile. It fails with the following error messages:
/home/tony/snap/arduino/current/Arduino/libraries/grblHAL_Due/src/driver.c: In function 'driver_init': /home/tony/snap/arduino/current/Arduino/libraries/grblHAL_Due/src/driver.c:1663:9: error: 'i' undeclared (first use in this function) for(i = 0 ; i < sizeof(inputpin) / sizeof(input_signal_t); i++) { ^ /home/tony/snap/arduino/current/Arduino/libraries/grblHAL_Due/src/driver.c:1663:9: note: each undeclared identifier is reported only once for each function it appears in Multiple libraries were found for "grblHAL_Due.h" Used: /home/tony/snap/arduino/current/Arduino/libraries/grblHAL_Due Not used: /home/tony/snap/arduino/current/Arduino/libraries/src exit status 1 Error compiling for board Arduino Due (Programming Port).
There are some oddities: The first is that the code snippet in the error does not appear at line 1663, but does appear in several other places. It also looks like the index variable i IS declared as uint32_t a few lines above.
I have tried removing and re-adding the libraries, and compiing for the native USB port. Same problem.