IPDM56: Difference between revisions

From openinverter.org wiki
Jump to navigation Jump to search
Line 30: Line 30:


For powering the board from 12V DC it makes sense to use either Pin 3 or 4 for ground but '''only Pin 2 for +12V'''. Pin 1 was +Vbat on V1.0, it's M11 on V1.1. An automotive fuse is recommended.
For powering the board from 12V DC it makes sense to use either Pin 3 or 4 for ground but '''only Pin 2 for +12V'''. Pin 1 was +Vbat on V1.0, it's M11 on V1.1. An automotive fuse is recommended.
[[File:12V connected.jpg|center|thumb|12V connected]]If you want to use '''high side''' outputs, you have wire the supply into Pins 55, 56 and 33 for HOUT 1-9. ''This can be a different voltage? HOUT10 is supplied by Pin 2?''
[[File:12V connected.jpg|center|thumb|12V connected]]If you want to use '''high side''' outputs, you have wire the supply into Pins 55, 56 and 33 for HOUT 1-9.  


== First program - blink LEDs ==
 
''Q: Can this be a different voltage? HOUT10 is supplied by Pin 2?''
 
== First program - blink LEDs ''off board'' ==
Set up the Arduino IDE. The ATMega 328 is also used on Arduino UNO, Arduino Pro Mini and Arduino Nano, so programming should be familiar. See https://docs.arduino.cc/hardware/uno-rev3 for some tips.
Set up the Arduino IDE. The ATMega 328 is also used on Arduino UNO, Arduino Pro Mini and Arduino Nano, so programming should be familiar. See https://docs.arduino.cc/hardware/uno-rev3 for some tips.


As the iPDM56 uses a CH340G USB-to-serial converter, the choice of bootloader will be ignored, just choose the correct serial port.
As the iPDM56 uses a CH340G USB-to-serial converter, the choice of bootloader will be ignored, just choose the correct serial port & Arduino Uno.
 
 
Q: ''are the classic delay(ms) & ipdm::delay(ms); problematic? the first bits work but above a certain cumulative delay the rest gets ignored''<syntaxhighlight lang="arduino" line="1">
/*
ipdmsw - iPDM56 firmware template
Copyright (c) 2023 Perttu "celeron55" Ahola
 
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/
 
#include "src/ipdm_library.h"
#include "src/ipdm_util.h"
#include "src/ipdm_can.h"
#include "src/params.h"
 
// Matrix inputs/outputs
constexpr int UNUSED_M1          = A0; // A0 = M1
constexpr int UNUSED_M2          = A1; // A1 = M2
constexpr int UNUSED_M3          = A2; // A2 = M3
constexpr int UNUSED_M4          = A3; // A3 = M4
constexpr int UNUSED_M5          = A6; // A6 = M5
constexpr int UNUSED_M6          =  2; // D2 = M6
constexpr int UNUSED_M7          =  3; // D3 = M7
constexpr int UNUSED_M8          = ipdm::ED4; // ED4 = M8
constexpr int UNUSED_M9          = ipdm::ED5; // ED5 = M9
constexpr int UNUSED_M10        = ipdm::ED6; // ED6 = M10
 
// Outputs
constexpr int LOUT1                      = ipdm::LOUT1; // Pin 45 LEFT Indicator
constexpr int LOUT2                      = ipdm::LOUT2; // Pin 46 RIGHT Indicator
constexpr int UNUSED_LOUT3                = ipdm::LOUT3;
constexpr int UNUSED_LOUT4                = ipdm::LOUT4;
constexpr int UNUSED_LOUT5                = ipdm::LOUT5;
constexpr int UNUSED_LOUT6                = ipdm::LOUT6;
constexpr int UNUSED_HOUT1                = ipdm::HOUT1;
constexpr int UNUSED_HOUT2                = ipdm::HOUT2;
constexpr int UNUSED_HOUT3                = ipdm::HOUT3;
constexpr int UNUSED_HOUT4                = ipdm::HOUT4;
constexpr int UNUSED_HOUT5                = ipdm::HOUT5;
constexpr int UNUSED_HOUT6                = ipdm::HOUT6;
constexpr int UNUSED_AOUT1                = ipdm::AOUT1;
constexpr int UNUSED_AOUT2                = ipdm::AOUT2;
 
void setup()
{
Serial.begin(115200);
 
ipdm::setup();
 
}
 
void loop()
{
ipdm::loop();
 
EVERY_N_MILLISECONDS(30000){
ipdm::util_print_timestamp(Serial);
Serial.println("-!- iPDM56 running");
}
 
 
// Print out output changes using a helper macro
EVERY_N_MILLISECONDS(1000){
REPORT_BOOL(ipdm::digitalRead(LOUT1));
REPORT_BOOL(ipdm::digitalRead(LOUT2));
}
 
// Example: blink external LEDs via low side outputs - intention: flash both 1x,  right 2x, left 2x, repeat
ipdm::digitalWrite(ipdm::LOUT1, 1);
ipdm::digitalWrite(ipdm::LOUT2, 1);
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 0); 
ipdm::digitalWrite(ipdm::LOUT2, 0);   
   
    ipdm::digitalWrite(ipdm::LOUT2, 1);   
    ipdm::delay(400);
ipdm::digitalWrite(ipdm::LOUT2, 0);   
    ipdm::delay(400);   
ipdm::digitalWrite(ipdm::LOUT2, 1);   
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT2, 0); 
   
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 1); 
ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 0); 
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 1);
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 0); 
   
    ipdm::delay(400);     
 
}
</syntaxhighlight>

Revision as of 23:31, 18 April 2023

Getting started with the iPDM56 VCU

Note: all documentation is under https://github.com/celeron55/ipdm56

Connect the board to USB and power it up

This is a sanity check before you start soldering and chase your tail troubleshooting.

Use a good quality micro USB cable and power the board up through it via a charger or computer.

both LEDs are lit after the initial Arduino sketch has started

Solder the connector onto the board

Before you start soldering, test fit the PCB to see if the remaining holes line up with the threaded mounts of the enclosure.

Apart from soldering equipment you will need two small screws and nuts to secure the 56 pin header connector to the PCB so it is secured during soldering.

If you're in a rush, you should alternate between the two sections to avoid overheating the board and reduce stresses on the joints.

Connector PCB screws (borrowed from ATX mainboard mounts)
Connector secured for soldering
Alternating between both sides
all 56 pins soldered

Wiring in the pins

(starting with the USB connection)


Plastic grid removed, note different numbering
Numbering scheme of connector can be different!
Perforate the seal with multimeter probe, put the 4 wires from the USB cable through the grid.
Front view, note different numbering
Square and kerb a chopstick for pushing the crimped pins
Push the pins through

For powering the board from 12V DC it makes sense to use either Pin 3 or 4 for ground but only Pin 2 for +12V. Pin 1 was +Vbat on V1.0, it's M11 on V1.1. An automotive fuse is recommended.

12V connected

If you want to use high side outputs, you have wire the supply into Pins 55, 56 and 33 for HOUT 1-9.


Q: Can this be a different voltage? HOUT10 is supplied by Pin 2?

First program - blink LEDs off board

Set up the Arduino IDE. The ATMega 328 is also used on Arduino UNO, Arduino Pro Mini and Arduino Nano, so programming should be familiar. See https://docs.arduino.cc/hardware/uno-rev3 for some tips.

As the iPDM56 uses a CH340G USB-to-serial converter, the choice of bootloader will be ignored, just choose the correct serial port & Arduino Uno.


Q: are the classic delay(ms) & ipdm::delay(ms); problematic? the first bits work but above a certain cumulative delay the rest gets ignored

/*
ipdmsw - iPDM56 firmware template
Copyright (c) 2023 Perttu "celeron55" Ahola

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

#include "src/ipdm_library.h"
#include "src/ipdm_util.h"
#include "src/ipdm_can.h"
#include "src/params.h"

// Matrix inputs/outputs
constexpr int UNUSED_M1          = A0; // A0 = M1
constexpr int UNUSED_M2          = A1; // A1 = M2
constexpr int UNUSED_M3          = A2; // A2 = M3
constexpr int UNUSED_M4          = A3; // A3 = M4
constexpr int UNUSED_M5          = A6; // A6 = M5
constexpr int UNUSED_M6          =  2; // D2 = M6
constexpr int UNUSED_M7          =  3; // D3 = M7
constexpr int UNUSED_M8          = ipdm::ED4; // ED4 = M8
constexpr int UNUSED_M9          = ipdm::ED5; // ED5 = M9
constexpr int UNUSED_M10         = ipdm::ED6; // ED6 = M10

// Outputs
constexpr int LOUT1                       = ipdm::LOUT1; // Pin 45 LEFT Indicator
constexpr int LOUT2                       = ipdm::LOUT2; // Pin 46 RIGHT Indicator
constexpr int UNUSED_LOUT3                = ipdm::LOUT3;
constexpr int UNUSED_LOUT4                = ipdm::LOUT4;
constexpr int UNUSED_LOUT5                = ipdm::LOUT5;
constexpr int UNUSED_LOUT6                = ipdm::LOUT6;
constexpr int UNUSED_HOUT1                = ipdm::HOUT1;
constexpr int UNUSED_HOUT2                = ipdm::HOUT2;
constexpr int UNUSED_HOUT3                = ipdm::HOUT3;
constexpr int UNUSED_HOUT4                = ipdm::HOUT4;
constexpr int UNUSED_HOUT5                = ipdm::HOUT5;
constexpr int UNUSED_HOUT6                = ipdm::HOUT6;
constexpr int UNUSED_AOUT1                = ipdm::AOUT1;
constexpr int UNUSED_AOUT2                = ipdm::AOUT2;

void setup()
{
	Serial.begin(115200);

	ipdm::setup();

	
}

void loop()
{
	ipdm::loop();

	EVERY_N_MILLISECONDS(30000){
		ipdm::util_print_timestamp(Serial);
		Serial.println("-!- iPDM56 running");
	}


	// Print out output changes using a helper macro
	EVERY_N_MILLISECONDS(1000){
		REPORT_BOOL(ipdm::digitalRead(LOUT1));
		REPORT_BOOL(ipdm::digitalRead(LOUT2));
				
	}

	// Example: blink external LEDs via low side outputs - intention: flash both 1x,  right 2x, left 2x, repeat
	
	ipdm::digitalWrite(ipdm::LOUT1, 1);
	ipdm::digitalWrite(ipdm::LOUT2, 1);
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 0);  
	ipdm::digitalWrite(ipdm::LOUT2, 0);    
    
    ipdm::digitalWrite(ipdm::LOUT2, 1);    
    ipdm::delay(400);
	ipdm::digitalWrite(ipdm::LOUT2, 0);    
    ipdm::delay(400);    
	ipdm::digitalWrite(ipdm::LOUT2, 1);    
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT2, 0);  
    
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 1);  
	ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 0);  
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 1);
    ipdm::delay(400);
    ipdm::digitalWrite(ipdm::LOUT1, 0);  
    
    ipdm::delay(400);      
	

}