From 0c782176701fed80285ef7fe97fbf3028deac902 Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Sun, 11 Jul 2021 15:22:38 +0900 Subject: [PATCH 1/7] Update test_prcedure.md --- step800_hardware_tests/test_prcedure.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/step800_hardware_tests/test_prcedure.md b/step800_hardware_tests/test_prcedure.md index 9facf9b..523842f 100644 --- a/step800_hardware_tests/test_prcedure.md +++ b/step800_hardware_tests/test_prcedure.md @@ -43,8 +43,7 @@ - Connect Atmel-ICE Basic with a PC with USB microB cable. - Connect the programming cable to the “**SAM**” connector of the Atmel-ICE Basic - For the cable, use the right connector to the Atmel-ICE Basic, and the center connector to the PCB. We won’t use the left connector. - - + - Remove the small plastic cover from `SWD` pin header on the PCB. Do not discard this cover, we will use it later. - Then connect a programming socket (the 1.27mm pitch 10pin connector in the middle of the cable) to `SWD` pinheader on the PCB. Be aware of the small circle marking which placed the pin no.1 of the `SWD` connector. The red line of the programming cable indicates the pin no.1 side of the programming header. From 9d6371a49c4e749000d63cdf2096cabeb0a25180 Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Mon, 12 Jul 2021 14:40:17 +0900 Subject: [PATCH 2/7] Update test_prcedure.md --- step800_hardware_tests/test_prcedure.md | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/step800_hardware_tests/test_prcedure.md b/step800_hardware_tests/test_prcedure.md index 523842f..ed7f017 100644 --- a/step800_hardware_tests/test_prcedure.md +++ b/step800_hardware_tests/test_prcedure.md @@ -30,36 +30,40 @@ 2. Specify the target board as `Arduino Zero (Native USB Port)` . 3. Press the “VERIFY” button. Then Arduino IDE starts the compile the program (which called “Sketch” in the IDE). + ![](https://arduinotogo.com/wp-content/uploads/2016/07/ch3-buttons-labelled.png) 4. If the compiling process is done successfully, you will see a “Done compiling.” sign. ![image](https://user-images.githubusercontent.com/1097902/125183648-49029100-e253-11eb-86c9-38e77f9145b9.png) -# Programming the MCU -## 1. Apply the power supply +## Programming the MCU +### 1. Apply the power supply - Apply 24V DC to the PCB with DC input jack (5.5mm outer diameter, 2.1mm inter diameter, center plus). [ ] Check the green LED (designator `3.3V` ) -## 2. Connect Atmel-ICE Basic +### 2. Connect Atmel-ICE Basic - Connect Atmel-ICE Basic with a PC with USB microB cable. - Connect the programming cable to the “**SAM**” connector of the Atmel-ICE Basic -- For the cable, use the right connector to the Atmel-ICE Basic, and the center connector to the PCB. We won’t use the left connector. +- For the cable, use the right connector in the following photo to the Atmel-ICE Basic, and the center connector to the PCB. We won’t use the left connector. -- Remove the small plastic cover from `SWD` pin header on the PCB. Do not discard this cover, we will use it later. +- Remove the small plastic cover from `SWD` pin header on the PCB. Do not discard this cover, we will put this back to the connector later. - Then connect a programming socket (the 1.27mm pitch 10pin connector in the middle of the cable) to `SWD` pinheader on the PCB. Be aware of the small circle marking which placed the pin no.1 of the `SWD` connector. The red line of the programming cable indicates the pin no.1 side of the programming header. -![Pin no.1 is situated in the left bottom corner in this image. The red line of the programming cable should come to the same side of the SWD connector.](https://paper-attachments.dropbox.com/s_C4BFE802A808CAA525133E919C7A0A02329425BB61F7484D642CD4904227D66C_1611579199576_image.png) + -[ ] Green LED on Atmel-ICE Basic should be on. +- [ ] Green LED on Atmel-ICE Basic should be on. -## 3. Burn Arduino bootloader to the PCB +### 3. Burn Arduino bootloader to the PCB - Arduino bootloader can write from Arduino IDE. Select `Programmer` item from `Tools` menu, then select `Atmel-ICE`. -![](https://paper-attachments.dropbox.com/s_C4BFE802A808CAA525133E919C7A0A02329425BB61F7484D642CD4904227D66C_1609391577581_image.png) +![image](https://user-images.githubusercontent.com/1097902/125235519-8df2fa00-e31d-11eb-8c4e-d8952a9e9fbd.png) - Then select `Burn Bootloader` item of `Tools` menu. -![](https://paper-attachments.dropbox.com/s_C4BFE802A808CAA525133E919C7A0A02329425BB61F7484D642CD4904227D66C_1609391606908_image.png) +![image](https://user-images.githubusercontent.com/1097902/125235534-93e8db00-e31d-11eb-9eda-bdcc99b7e92b.png) - After programming process, -[ ] Orange LED on the PCB (designator `L` ) will be fading in & out slowly. +- [ ] Orange LED on the PCB (designator `L` ) will be fading in & out slowly. + +### 4. Put the cover back to the SWD connector +Remove Atmel-ICE-Basic from the PCB and put the black plastic cover back to the SWD connector. From b66cd7ea6ce1ca711f5487e3b0d1bdf1f722d51e Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Mon, 12 Jul 2021 18:57:06 +0900 Subject: [PATCH 3/7] Rename test_prcedure.md to 1_preparation.md --- step800_hardware_tests/{test_prcedure.md => 1_preparation.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename step800_hardware_tests/{test_prcedure.md => 1_preparation.md} (100%) diff --git a/step800_hardware_tests/test_prcedure.md b/step800_hardware_tests/1_preparation.md similarity index 100% rename from step800_hardware_tests/test_prcedure.md rename to step800_hardware_tests/1_preparation.md From 12436a1c596a64acc063ab303a797a6cfb45e576 Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Mon, 12 Jul 2021 22:16:27 +0900 Subject: [PATCH 4/7] Update 1_preparation.md --- step800_hardware_tests/1_preparation.md | 274 +++++++++++++++++++++++- 1 file changed, 273 insertions(+), 1 deletion(-) diff --git a/step800_hardware_tests/1_preparation.md b/step800_hardware_tests/1_preparation.md index ed7f017..593737c 100644 --- a/step800_hardware_tests/1_preparation.md +++ b/step800_hardware_tests/1_preparation.md @@ -9,6 +9,13 @@ - Network Switch which support 100BASE-TX or faster. - Ethernet cable CAT5 or higher. +### microSD card setup +1. Format the **microSD** or **microSDHC** card with FAT16 or FAT32. + Note : microSDXC card will not work. +2. Download the test text data from here; https://raw.githubusercontent.com/kanta/STEP400_prototype/master/rev4/configTool/sample-setups/SM-42BYG011_24V/config.txt +3. Copy it to the top directory of the microSD card. +4. Remove the card from a PC and put into the microSD card slot on STEP800. +5. ### Arduino IDE setup 1. Download and install latest Arduino IDE from https://www.arduino.cc/en/Main/Software 2. Install SAMD boards core. Procedure is explained here: https://www.arduino.cc/en/Guide/ArduinoZero @@ -26,7 +33,7 @@ #### Download and Compile the test program -1. Download the program from here. https://github.com/ponoor/STEP400/blob/master/hardwareTestSketch/hardwareTestSketch.ino +1. Download the program from [here](https://github.com/ponoor/STEP400/blob/master/hardwareTestSketch/hardwareTestSketch.ino), and open it with the Arduino IDE software. 2. Specify the target board as `Arduino Zero (Native USB Port)` . 3. Press the “VERIFY” button. Then Arduino IDE starts the compile the program (which called “Sketch” in the IDE). @@ -67,3 +74,268 @@ ### 4. Put the cover back to the SWD connector Remove Atmel-ICE-Basic from the PCB and put the black plastic cover back to the SWD connector. + +## Upload the test program +### Select a serial port from Arduino IDE +1. Connect the USB connector to a PC with an USB type-C cable. +2. Open the IDE and click to the "Tools" menu and then *Port.* Then you should be able to find a serial port(s) and select one with information as `Arduino Zero (Native USB Port))` . +![image](https://user-images.githubusercontent.com/1097902/125291455-64a58e80-e35c-11eb-9130-723e42b0d35d.png) +3. If there is no serial port in the menu, probably the Arduino Zero bootloader isn’t programmed correctly. +4. Click the upload button. The compile process will take a while. +5. After the compile process is done, Arduino IDE will start upload it to STEP800. You will see the `TX` and `RX` LEDs on STEP800 are blinking during the upload process. + +## Setups for the test +### Select the serial port again +Once the first sketch is uploaded to STEP800, the name of serial port will change from the original one. Select one with information as `Arduino Zero (Native USB Port))` again. + +### Connect the Ethernet connector +Connect the Ethernet connector to a network switch with an Ethernet cable. This is used for check the ethernet link connection is established or not. + +## Test Procedure +Finally we are ready to start the test! + +### Open a Serial Monitor +Click the lens button on the top right corner of the IDE window. +![image](https://user-images.githubusercontent.com/1097902/125292147-20ff5480-e35d-11eb-9c2d-bd06d57e2057.png) + +Then you will see a new Serial Monitor window. You will find some settings in the bottom of the window but you can leave them as defaults. + +### Send a test command +Select a transmission text form (see below) and type `t` then return key. +![image](https://user-images.githubusercontent.com/1097902/125292308-4be9a880-e35d-11eb-92e4-6fa46b88a58d.png) + +## Description of each tests +### microSD card slot + +**Description** +This test checks the microSD card slot is working correctly or not. +The successful test result will look like this; + + -------------- SD card -------------- + SD card initialize: Ok + SD_DETECT_PIN: 0 Ok + + Test result: Passed + +**SD card initialize** +This item checks the connection with microSD card. If this test failed, please check followings; + +- The microSD card is inserted +- Using a microSD or a microSDHC card, NOT microSDXC +- The microSD card is formatted with FAT16 or FAT32 formant, NOT exFAT +- SPI wires for the microSD slot are wired correctly. + +**SD_DETECT_PIN** +This items checks the logical correctness of the microSD card detect pin. + +**Related pins** + +| MCU pin# | Function | +| -------- | ------------------------------------ | +| 13 | microSD SPI CS | +| 19 | microSD SPI MOSI (Shared with W5500) | +| 20 | microSD SPI SCK (Shared with W5500) | +| 21 | microSD SPI MISO (Shared with W5500) | +| 10 | SD_DETECT_PIN | + +### Electromagnetic Brake Pins + +**Description** +This test checks the electromagnetic brake pins, which connected with the 6pin box header (designator `J7`). +The successful test result will look like this; + + -------------- Electromagnetic Brake Pins -------------- + brakePin connection state: Ok + + Test result: Passed + +This test confirms that each pin is not interfering with each other. + +**Related pins** + +| MCU pin# | Box header pin# | Function | +| -------- | --------------- | -------------------------- | +| 7 | 1 | Electromagnet brake pin #1 | +| 11 | 2 | Electromagnet brake pin #2 | +| 24 | 3 | Electromagnet brake pin #3 | +| 15 | 4 | Electromagnet brake pin #4 | + +### Auxiliary Pins + +**Descriptions** +This test checks the auxiliary pad pins which exposed in the bottom side of the PCB. +The successful test result will look like this; + + -------------- Auxiliary Pins -------------- + Auxiliary Pins connection state: Ok + + Test result: Passed + +This test confirms that each pin is not interfering with each other. + +**Related pins** + +| MCU pin# | Pad name (in Bottom side) | +| -------- | ------------------------- | +| 31 | SDA | +| 32 | SCL | +| 22 | D38 | + +### Ethernet + +**Descriptions** +This test the Ethernet controller chip and a physical connection of the network. +The successful test result will look like this; + + -------------- Ethernet -------------- + Ethernet hardware status: 3, -EthernetW5500 Ok + Ethernet link status: 2 ..Ok + + Test result: Passed + +**Ethernet hardware status** +This test checks the SPI communication with the Ethernet controller chip W5500 (`IC1`). If this test failed, please check the W5500 chip or wiring. + +**Ethernet link status** +This test checks the physical connection of Ethernet. This test wait a few seconds to establish the connection. If the connection couldn’t establish within the waiting period, the test becomes failed. If so, please check the followings; + +- Ethernet cable is connected with a network switch. +- Check the RJ45 connector `X3` and related components include; `C34, C35, C36, C37, R14, RN2, RN3` + +**Related pins** + +| MCU pin# | Function | +| -------- | ------------------------------------ | +| 9 | W5500 RESET | +| 27 | W5500 SPI CS | +| 19 | W5500 SPI MOSI (shared with microSD) | +| 20 | W5500 SPI SCK (shared with microSD) | +| 21 | W5500 SPI MISO (shared with microSD) | + +### PowerSTEP01 + +**Description** +This test checks the motor driver chip PowerSTEP01. +The successful test result will look like this; + + -------------- PowerSTEP01 -------------- + PowerSTEP01 SPI connection: Ok + PowerSTEO01 ID#1 + STATUS: 0xE603 Ok + SW_F: 0 Ok + ADC_OUT: 31 Ok + PowerSTEO01 ID#2 + STATUS: 0xE603 Ok + SW_F: 0 Ok + ADC_OUT: 31 Ok + PowerSTEO01 ID#3 + STATUS: 0xE603 Ok + SW_F: 0 Ok + ADC_OUT: 31 Ok + PowerSTEO01 ID#4 + STATUS: 0xE603 Ok + SW_F: 0 Ok + ADC_OUT: 31 Ok + + Test result: Passed + +**PowerSTEP01 SPI connection** +This results shows the physical connection of the SPI daisy chain of 4 PowerSTEP01s are working or not. All SPI pins of all PoweSTEP01s and the MCU have to be connected properly to establish the SPI communication. +If this test failed, please check the connections of following pins; + +| MCU pin# | PowerSTEP01 pin# | Function | +| -------- | ---------------- | -------------------- | +| 3 | 10 | PowerSTEP01 SPI CS | +| 8 | 19 | PowerSTEP01 RESET | +| 25 | 12 | PowerSTEP01 SPI MOSI | +| 28 | 11 | PowerSTEP01 SPI SCK | +| 29 | 14 | PowerSTEP01 SPI MISO | + +**STATUS** +This item shows the status of each PowerSTEP01. There are several possible errors here. + + +- `OCD(Over Current) detected.` : This error indicates an overcurrent detection event. Probably something is wrong in following pins; + +| PowerSTEP01 pin# | Function | +| ---------------------- | -------- | +| 9 | SENSEB_S | +| 20 | SENSEA_S | +| 34, 35, 36, 39, 40, 41 | SENSEA_P | +| 77, 78, 79, 82, 83, 84 | SENSEB_P | + +- `UVLO(Under Voltage Lock Out) detected.` : This error will happen then a VCC of the PowerSTEP01 is too low. Check a DC24V power supply is connected properly, and following pin connections; + +| PowerSTEP01 pin# | Function | +| ---------------- | -------- | +| 55 | VS | +| 56 | VBOOT | +| 58 | VCC | +| 60 | VCCREG | +| 61 | VSREG | +| 62 | VREG | + +- `OCD+UVLO detected.` : This error happens when the external clock source is not provided. Check the crystal oscillator `Q3` and external clock input and output pins of PowerSTEP01. The external clock is daisy chained among PowerSTEP01s, `Q3` → `U5` → `U6` → `U7` → `U8`. + +| PowerSTEP01 pin# | Function | +| ----------------- | -------- | +| 64 | OSCIN | +| 65 | OSCOUT | + +**SW_F** +This item checks the state of SW pin of PowerSTEP01, which connected to HOME sensor connector. + +| PowerSTEP01 pin# | Function | +| ---------------- | -------- | +| 18 | SW | + +**ADC_OUT** +This item checks ADCIN pin of PowerSTEP01, which connected to LIMIT sensor connector. + +| PowerSTEP01 pin# | Function | +| ---------------- | -------- | +| 54 | ADCIN | + +### DIP Switch + +**Descriptions** +This test checks the DIP switch (designator `ID`) and you need to move all digits of the switch by yourself to complete the test. +The successful test result will look like this; +Initially you will see the following message. + + -------------- DIP Switch -------------- + Move all digits of the switch + (Type `b` to cancel the test.) + +Then please move each digits of the switch. + + Ok -- -- -- -- -- -- -- + Ok Ok -- -- -- -- -- -- + Ok Ok Ok -- -- -- -- -- + Ok Ok Ok Ok -- -- -- -- + Ok Ok Ok Ok Ok -- -- -- + Ok Ok Ok Ok Ok Ok -- -- + Ok Ok Ok Ok Ok Ok Ok -- + Ok Ok Ok Ok Ok Ok Ok Ok + + Test result: Passed + +You will see the message every time you moved the digit. +This test will be finished when all 8 digits are successfully moved. + +If you need to cancel this DIP switch test for some reason, you can type `b`. + +### Test result + +Finally you will see the result. The last line shows the total result. + + -------------- Result of Hardware Test -------------- + SD Card: Ok + Brake Pins: Ok + Auxiliary Pins: Ok + Ethernet: Ok + PowerSTEP01: Ok + DIP switch: Ok + + Test result: Ok + From cff07f2ff2aa5c67bec5b51951957503248b8acc Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Fri, 16 Jul 2021 10:58:04 +0900 Subject: [PATCH 5/7] Update and rename 1_preparation.md to test_procedure.md --- .../{1_preparation.md => test_procedure.md} | 215 +++++++++--------- 1 file changed, 110 insertions(+), 105 deletions(-) rename step800_hardware_tests/{1_preparation.md => test_procedure.md} (75%) diff --git a/step800_hardware_tests/1_preparation.md b/step800_hardware_tests/test_procedure.md similarity index 75% rename from step800_hardware_tests/1_preparation.md rename to step800_hardware_tests/test_procedure.md index 593737c..5cec9c3 100644 --- a/step800_hardware_tests/1_preparation.md +++ b/step800_hardware_tests/test_procedure.md @@ -138,28 +138,6 @@ This items checks the logical correctness of the microSD card detect pin. | 21 | microSD SPI MISO (Shared with W5500) | | 10 | SD_DETECT_PIN | -### Electromagnetic Brake Pins - -**Description** -This test checks the electromagnetic brake pins, which connected with the 6pin box header (designator `J7`). -The successful test result will look like this; - - -------------- Electromagnetic Brake Pins -------------- - brakePin connection state: Ok - - Test result: Passed - -This test confirms that each pin is not interfering with each other. - -**Related pins** - -| MCU pin# | Box header pin# | Function | -| -------- | --------------- | -------------------------- | -| 7 | 1 | Electromagnet brake pin #1 | -| 11 | 2 | Electromagnet brake pin #2 | -| 24 | 3 | Electromagnet brake pin #3 | -| 15 | 4 | Electromagnet brake pin #4 | - ### Auxiliary Pins **Descriptions** @@ -180,6 +158,11 @@ This test confirms that each pin is not interfering with each other. | 31 | SDA | | 32 | SCL | | 22 | D38 | +|12|D9| +|11|D8| +|7|A1| +|15|D1| +|30|D7| ### Ethernet @@ -212,44 +195,62 @@ This test checks the physical connection of Ethernet. This test wait a few secon | 20 | W5500 SPI SCK (shared with microSD) | | 21 | W5500 SPI MISO (shared with microSD) | -### PowerSTEP01 +### L6470 **Description** -This test checks the motor driver chip PowerSTEP01. +This test checks the motor driver chip L6470. The successful test result will look like this; - -------------- PowerSTEP01 -------------- - PowerSTEP01 SPI connection: Ok - PowerSTEO01 ID#1 - STATUS: 0xE603 Ok - SW_F: 0 Ok - ADC_OUT: 31 Ok - PowerSTEO01 ID#2 - STATUS: 0xE603 Ok - SW_F: 0 Ok - ADC_OUT: 31 Ok - PowerSTEO01 ID#3 - STATUS: 0xE603 Ok - SW_F: 0 Ok - ADC_OUT: 31 Ok - PowerSTEO01 ID#4 - STATUS: 0xE603 Ok - SW_F: 0 Ok - ADC_OUT: 31 Ok - - Test result: Passed - -**PowerSTEP01 SPI connection** -This results shows the physical connection of the SPI daisy chain of 4 PowerSTEP01s are working or not. All SPI pins of all PoweSTEP01s and the MCU have to be connected properly to establish the SPI communication. +``` +-------------- L6470 -------------- +L6470 SPI connection: Ok +L6470 ID#1 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#2 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#3 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#4 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#5 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#6 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#7 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok +L6470 ID#8 + STATUS: 0x7E30 Ok + SW_F: 0 Ok + BUSY: 0 Ok + +Test result: Passed +``` + +**L6470 SPI connection** +This results shows the physical connection of the SPI daisy chain of 8 L6470s are working or not. All SPI pins of all L6470s and the MCU have to be connected properly to establish the SPI communication. If this test failed, please check the connections of following pins; -| MCU pin# | PowerSTEP01 pin# | Function | +| MCU pin# | L6470 pin# | Function | | -------- | ---------------- | -------------------- | -| 3 | 10 | PowerSTEP01 SPI CS | -| 8 | 19 | PowerSTEP01 RESET | -| 25 | 12 | PowerSTEP01 SPI MOSI | -| 28 | 11 | PowerSTEP01 SPI SCK | -| 29 | 14 | PowerSTEP01 SPI MISO | +| 3 | 23 | L6470 SPI CS | +| 8 | 3 | L6470 RESET | +| 25 | 20 | L6470 SPI MOSI | +| 28 | 19 | L6470 SPI SCK | +| 29 | 18 | L6470 SPI MISO | **STATUS** This item shows the status of each PowerSTEP01. There are several possible errors here. @@ -257,85 +258,89 @@ This item shows the status of each PowerSTEP01. There are several possible error - `OCD(Over Current) detected.` : This error indicates an overcurrent detection event. Probably something is wrong in following pins; -| PowerSTEP01 pin# | Function | +| L6470 pin# | Function | | ---------------------- | -------- | -| 9 | SENSEB_S | -| 20 | SENSEA_S | -| 34, 35, 36, 39, 40, 41 | SENSEA_P | -| 77, 78, 79, 82, 83, 84 | SENSEB_P | +| 1 | OUT1A | +| 14 | OUT1B | +| 15 | OUT2A | +| 28 | OUT2B | -- `UVLO(Under Voltage Lock Out) detected.` : This error will happen then a VCC of the PowerSTEP01 is too low. Check a DC24V power supply is connected properly, and following pin connections; +- `UVLO(Under Voltage Lock Out) detected.` : This error will happen then a VCC of the L6470 is too low. Check the power supply is connected properly, and following pin connections; -| PowerSTEP01 pin# | Function | +| L6470 pin# | Function | | ---------------- | -------- | -| 55 | VS | -| 56 | VBOOT | -| 58 | VCC | -| 60 | VCCREG | -| 61 | VSREG | -| 62 | VREG | +| 2, 26 | VSA | +| 12, 16 | VSB | +| 10 | CP | +| 11 | VBOOT | -- `OCD+UVLO detected.` : This error happens when the external clock source is not provided. Check the crystal oscillator `Q3` and external clock input and output pins of PowerSTEP01. The external clock is daisy chained among PowerSTEP01s, `Q3` → `U5` → `U6` → `U7` → `U8`. +- `OCD+UVLO detected.` : This error happens when the external clock source is not provided. Check the crystal oscillator `Q3` and external clock input and output pins of L6470. The external clock is daisy chained among L6470s, `Q3` → `U6` → `U7` → `U8` → `U9` → `U10` → `U11` → `U12` → `U13`. -| PowerSTEP01 pin# | Function | +| L6470 pin# | Function | | ----------------- | -------- | -| 64 | OSCIN | -| 65 | OSCOUT | +| 7 | OSCIN | +| 8 | OSCOUT | **SW_F** This item checks the state of SW pin of PowerSTEP01, which connected to HOME sensor connector. -| PowerSTEP01 pin# | Function | +| L6470 pin# | Function | | ---------------- | -------- | -| 18 | SW | +| 4 | SW | -**ADC_OUT** -This item checks ADCIN pin of PowerSTEP01, which connected to LIMIT sensor connector. - -| PowerSTEP01 pin# | Function | -| ---------------- | -------- | -| 54 | ADCIN | ### DIP Switch **Descriptions** This test checks the DIP switch (designator `ID`) and you need to move all digits of the switch by yourself to complete the test. -The successful test result will look like this; Initially you will see the following message. - -------------- DIP Switch -------------- - Move all digits of the switch - (Type `b` to cancel the test.) - -Then please move each digits of the switch. - - Ok -- -- -- -- -- -- -- - Ok Ok -- -- -- -- -- -- - Ok Ok Ok -- -- -- -- -- - Ok Ok Ok Ok -- -- -- -- - Ok Ok Ok Ok Ok -- -- -- - Ok Ok Ok Ok Ok Ok -- -- - Ok Ok Ok Ok Ok Ok Ok -- - Ok Ok Ok Ok Ok Ok Ok Ok - - Test result: Passed +``` +-------------- DIP Switch -------------- +Turn the digit #1 ON... +``` +Move the specified digit of the switch. Then you will see a next message. +Eventually the test result will look something like this; + +``` +-------------- DIP Switch -------------- +Turn the digit #1 ON....Done. +Turn the digit #1 OFF...Done. +Turn the digit #2 ON.Done. +Turn the digit #2 OFF..Done. +Turn the digit #3 ON..Done. +Turn the digit #3 OFF..Done. +Turn the digit #4 ON..Done. +Turn the digit #4 OFF..Done. +Turn the digit #5 ON..Done. +Turn the digit #5 OFF.Done. +Turn the digit #6 ON..Done. +Turn the digit #6 OFF..Done. +Turn the digit #7 ON...Done. +Turn the digit #7 OFF.Done. +Turn the digit #8 ON..Done. +Turn the digit #8 OFF..Done. + +Test result: Passed +``` You will see the message every time you moved the digit. This test will be finished when all 8 digits are successfully moved. -If you need to cancel this DIP switch test for some reason, you can type `b`. +If you need to cancel this DIP switch test you can type `b`. ### Test result Finally you will see the result. The last line shows the total result. - -------------- Result of Hardware Test -------------- - SD Card: Ok - Brake Pins: Ok - Auxiliary Pins: Ok - Ethernet: Ok - PowerSTEP01: Ok - DIP switch: Ok - - Test result: Ok +``` +-------------- Result of Hardware Test -------------- +SD Card: Ok +Auxiliary Pins: Ok +Ethernet: Ok +L6470: Ok +DIP switch: Ok + +Test result: Passed +``` From d67a22c2005adcc721c8b76aeb4d7132999b721f Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Fri, 16 Jul 2021 11:09:52 +0900 Subject: [PATCH 6/7] update the hardware test sketch --- .../step800_hardware_tests.ino | 478 ++++++++++++++++++ step800_hardware_tests/src/main.cpp | 16 +- 2 files changed, 487 insertions(+), 7 deletions(-) create mode 100644 step800_hardware_tests/Arduino/step800_hardware_tests/step800_hardware_tests.ino diff --git a/step800_hardware_tests/Arduino/step800_hardware_tests/step800_hardware_tests.ino b/step800_hardware_tests/Arduino/step800_hardware_tests/step800_hardware_tests.ino new file mode 100644 index 0000000..70821dc --- /dev/null +++ b/step800_hardware_tests/Arduino/step800_hardware_tests/step800_hardware_tests.ino @@ -0,0 +1,478 @@ +// Arduino Sketch for STEP800 Hardware Inspections +// target : STEP800 / Arduino Zero Native USB port +// by Kanta HORIO / Ponoor Experiments inc + +#include +#include +#include +#include +#include +#include +#include "wiring_private.h" // pinPeripheral() function + + +#define COMPILE_DATE __DATE__ +#define COMPILE_TIME __TIME__ +constexpr auto FIRMWARE_NAME = "STEP800_r1_hardware_test_r1.0.0"; +String results; +FlashStorage(storage, String); + +#define SD_CS_PIN 4u +#define SD_DETECT_PIN A4 + #define ledPin 13u + // L6470 + #define L6470_MISO 6u // D6 /SERCOM3/PAD[2] miso + #define L6470_MOSI 11u // D11/SERCOM3/PAD[0] mosi + #define L6470_SCK 12u // D12/SERCOM3/PAD[3] sck + + #define L6470_CS_PIN A0 + #define L6470_RESET_PIN A2 + // Shift registers + // 74HC165 +74HC595 for the dip sw input and the brake output + #define MISO3 3u // SERCOM2/PAD[1] + #define MOSI3 2u // SERCOM2/PAD[2] + #define SCK3 0u // SERCOM2/PAD[3] + #define LATCH3 A5 + // Shift registers SPI + extern SPIClass SPI3; + + // W5500 + #define W5500_RESET_PIN A3 + + #define SHIFTOUT_ENABLE_PIN 5u + +const uint8_t auxPin[8] = {7u,1u,A1,6u,9u,38u,SCL,SDA}; +#define NUM_OF_MOTOR (8) +SPIClass L6470SPI(&sercom3, L6470_MISO, L6470_SCK, L6470_MOSI, SPI_PAD_0_SCK_3, SERCOM_RX_PAD_2);// MISO/SCK/MOSI pins + +SPIClass SPI3(&sercom2, MISO3, SCK3, MOSI3, SPI_PAD_2_SCK_3, SERCOM_RX_PAD_1); + + +// L6470 +AutoDriver stepper[] = { + AutoDriver(7, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(6, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(5, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(4, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(3, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(2, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(1, L6470_CS_PIN, L6470_RESET_PIN), + AutoDriver(0, L6470_CS_PIN, L6470_RESET_PIN) +}; + +// Network +byte mac[] = { 0x60, 0x95, 0xCE, 0x10, 0x02, 0x90 }; +IPAddress + myIp(10, 0, 0, 100), + destIp(10, 0, 0, 10), + dns(10, 0, 0, 1), + gateway(10, 0, 0, 1), + subnet(255, 255, 255, 0); +EthernetUDP Udp; + +// Serial Monitor out utilities +#define p(fmt, ...) p_(F(fmt), ##__VA_ARGS__) +void p_(const __FlashStringHelper* fmt, ...) +{ + char buf[128]; // resulting string limited to 128 chars + va_list args; + va_start(args, fmt); +#ifdef __AVR__ + vsnprintf_P(buf, sizeof(buf), (const char*)fmt, args); // progmem for AVR +#else + vsnprintf(buf, sizeof(buf), (const char*)fmt, args); // for the rest of the world +#endif + va_end(args); + SerialUSB.print(buf); + results += String(buf); +} + +void showHeader(String header) { + p("-------------- %s --------------\n", header.c_str()); +} + +void showBoolResult(bool t) { + if (t) { p("Ok\n"); } + else { p("Failed\n");} +} +void showTestResult(bool t) { + String res = (t) ? "Passed" : "Failed"; + p("\nTest result: %s\n\n", res.c_str()); +} + +// Title +void showTestTitle() { + showHeader("STEP800 hardware test"); + p("Firmware revision: %s\n",FIRMWARE_NAME); + p("Compiled at %s %s\n", COMPILE_DATE, COMPILE_TIME); +} +// SD card +bool sdTest() { + bool t, result = false; + showHeader("SD card"); + pinMode(SD_CS_PIN, OUTPUT); + pinMode(SD_DETECT_PIN, INPUT_PULLUP); + p("SD card initialize: "); + t = SD.begin(SD_CHIP_SELECT_PIN); + showBoolResult(t); + if (t) + { + SD.end(); + result = !digitalRead(SD_DETECT_PIN); + p("SD_DETECT_PIN: %d ", !result); + showBoolResult(result); + + } else { + if (digitalRead(SD_DETECT_PIN) == LOW) { + p("The SD card and/or SD slot connection is broken."); + } else { + p("SD card is not inserted."); + } + } + pinMode(SD_CS_PIN, INPUT); + showTestResult(result); + return result; +} + +// Auxiliary Pins +bool auxPinTest() { + showHeader("Auxiliary Pins"); + p("Auxiliary Pins connection state: "); + bool t = true; + for (uint8_t i = 0; i < 8; i++) + { + for (uint8_t j = 0; j < 8; j++) { + pinMode(auxPin[j], OUTPUT); + digitalWrite(auxPin[j], LOW); + } + pinMode(auxPin[i], INPUT_PULLUP); + t &= digitalRead(auxPin[i]); // the pin has to be HIGH + if (!t) { + p("\nauxPin#%d connection problem found.\n", i+1); + } + pinMode(auxPin[i],INPUT); + } + showBoolResult(t); + showTestResult(t); + return t; +} +// Ethernet +void resetW5500() { + pinMode(W5500_RESET_PIN, OUTPUT); + digitalWrite(W5500_RESET_PIN, HIGH); + delay(1); + digitalWrite(W5500_RESET_PIN, LOW); + delay(10); + digitalWrite(W5500_RESET_PIN, HIGH); + delay(10); + //Ethernet.init(10); + Ethernet.begin(mac, myIp); + Udp.begin(50000); +} +bool ethernetTest() { + uint8_t t; + String s; + bool result = false; + showHeader("Ethernet"); + digitalWrite(ledPin, HIGH); + resetW5500(); + delay(100); + digitalWrite(ledPin, LOW); + t = Ethernet.hardwareStatus(); + p("Ethernet hardware status: %d, ",t); + switch (t) + { + case EthernetNoHardware: + p("-EthernetNoHardware\nW5500 connection failed.\n"); + break; + case EthernetW5100: + p("-EthernetW5100\nWrong hardware detected.\n"); + break; + case EthernetW5200: + p("-EthernetW5200\nWrong hardware detected.\n"); + break; + case EthernetW5500: + p("-EthernetW5500 Ok\n"); + result = true; + break; + default: + break; + } + bool linked = true; + if (result) { + uint8_t counter = 0; + t = Ethernet.linkStatus(); + p("Ethernet link status: %d ", t); + while ( Ethernet.linkStatus() != LinkON ) { + delay(500); + counter++; + p("."); + if (counter>=8) { + p(" timeout\n"); + linked = false; + break; + } + } + if (linked) p("Ok\n"); + } + result &= linked; + pinMode(W5500_RESET_PIN, INPUT); + //SPI.end(); + showTestResult(result); + return result; +} + +// L6470 +bool L6470Test() { + showHeader("L6470"); + bool result = true; + boolean L6470_reset_pin_enable_state = HIGH; + pinMode(L6470_RESET_PIN, OUTPUT); + pinMode(L6470_CS_PIN, OUTPUT); + pinMode(L6470_MOSI, OUTPUT); + pinMode(L6470_MISO, INPUT); + pinMode(L6470_SCK, OUTPUT); + digitalWrite(L6470_RESET_PIN, L6470_reset_pin_enable_state); + digitalWrite(L6470_RESET_PIN, !L6470_reset_pin_enable_state); + delay(10); + digitalWrite(L6470_RESET_PIN, L6470_reset_pin_enable_state); + digitalWrite(L6470_CS_PIN, HIGH); + L6470SPI.begin(); + pinPeripheral(L6470_MOSI, PIO_SERCOM_ALT); + pinPeripheral(L6470_SCK, PIO_SERCOM_ALT); + pinPeripheral(L6470_MISO, PIO_SERCOM_ALT); + L6470SPI.setDataMode(SPI_MODE3); + + for (uint8_t i = 0; i < NUM_OF_MOTOR; i++) + { + stepper[i].SPIPortConnect(&L6470SPI); + digitalWrite(ledPin, HIGH); + delay(5); + digitalWrite(ledPin, LOW); + delay(5); + } + uint8_t i = 0; + uint16_t status[NUM_OF_MOTOR]; + uint32_t temp = 0; + + p("L6470 SPI connection: "); + for (i = 0; i < NUM_OF_MOTOR; i++) { + stepper[i].resetDev(); + stepper[i].setOscMode(EXT_16MHZ_OSCOUT_INVERT); // 16MHz for the production version + stepper[i].setVoltageComp(VS_COMP_DISABLE); + stepper[i].setParam(ALARM_EN, 0xEF); // Enable alarms except ADC UVLO + status[i] = stepper[i].getStatus(); // Clear Startup Flags + stepper[i].run(FWD, 200.0); // Test motion + status[i] = stepper[i].getStatus(); + temp += status[i]; + stepper[i].hardHiZ(); + } + showBoolResult(temp!=0); + + if (temp != 0) { + for ( i = 0; i < NUM_OF_MOTOR; i++) + { + temp = 0; + p("L6470 ID#%d\n STATUS: 0x%02X ",i+1, status[i]); + // OCD, active low, latched + if ((status[i] & STATUS_OCD) == 0) { + temp = 0x01; + } + // UVLO, active low + if ((status[i] & STATUS_UVLO) == 0) { + temp |= 0x02; + } + switch (temp) + { + case 0: + p(" Ok\n"); + break; + case 1: + // OCD detected. + p("OCD(Over Current) detected.\n"); + result = false; + break; + case 2: + // ULVO detected. + p("UVLO(Under Voltage LockOut) detected.\n"); + result = false; + break; + case 3: + // OCD+ULVO detected. + p("OCD+UVLO detected.\n"); + result = false; + break; + default: + break; + } + + // SW_F, low for open, high for close + bool swF = (status[i] & STATUS_SW_F); + p(" SW_F: %d ", swF); + showBoolResult(!swF); + if (swF == 1) { + p(" HOME senser input closed. Check HOME connection.\n"); + result = false; + } + + // BUSY + bool busyF = (status[i] &STATUS_BUSY); + p(" BUSY: %d ", busyF); // 1:NOT BUSY, 0:BUSY, should be in BUSY + showBoolResult(!busyF); + if (busyF == 1) { + p(" The test motor motion command can't excute.\n"); + result = false; + } + } + } else { + result = false; + } + L6470SPI.end(); + showTestResult(result); + return result; + +} +uint8_t getDipSw() { + uint8_t _id = 0; + digitalWrite(LATCH3, LOW); + digitalWrite(LATCH3, HIGH); + SPI3.transfer(0); // output for the brake + _id = SPI3.transfer(0); + _id = ~_id; + return _id; +} +// DIP switch +bool dipSwTest() { + showHeader("DIP Switch"); + bool result = true; + uint8_t t = 255, count = 0; + + // Shift Registers + SPI3.begin(); + pinPeripheral(MISO3, PIO_SERCOM_ALT); // MISO + pinPeripheral(MOSI3, PIO_SERCOM); // MOSI + pinPeripheral(SCK3, PIO_SERCOM_ALT); // SCK + SPI3.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); + pinMode(LATCH3, OUTPUT); + digitalWrite(LATCH3, HIGH); + pinMode(SHIFTOUT_ENABLE_PIN, OUTPUT); + digitalWrite(SHIFTOUT_ENABLE_PIN, HIGH); + + if ( getDipSw() != 0) { + p("Please set all digits 0(OFF): "); + + while ( t != 0) + { + t = getDipSw(); + delay(50); + count++; + if (count >=20 ) { p("."); count = 0;} + if (SerialUSB.available()>0) { + byte e = SerialUSB.read(); + if (e == 'b') { + p("Cancelled.\n"); + result = false; + return result; + } + } + } + p("\n"); + count = 0; + } + t= 0; + for (uint8_t i=0; i<8; i++) { + p("Turn the digit #%d ON.", i+1); + while ( t != 1) { + t = getDipSw(); + t = (t>>i) & 1; + delay(50); + count++; + if (count >=20 ) { p("."); count=0;} + if (SerialUSB.available()>0) { + byte e = SerialUSB.read(); + if (e == 'b') { + p("Cancelled.\n"); + result = false; + return result; + } + } + } + p("Done.\nTurn the digit #%d OFF.", i+1); + t = 1; + while ( t != 0) { + t = getDipSw(); + t = (t>>i) & 1; + delay(50); + count++; + if (count >=20 ) { p("."); count=0;} + if (SerialUSB.available()>0) { + byte e = SerialUSB.read(); + if (e == 'b') { + p("Cancelled.\n"); + result = false; + return result; + } + } + } + p("Done.\n"); + } + showTestResult(true); + return true; +} + +void setup() { + pinMode(ledPin, OUTPUT); + digitalWrite(ledPin, HIGH); + SerialUSB.begin(9600); +} + +void hardwareTest() { + bool testResult[5]; + bool t = true; + results = ""; + showTestTitle(); + t &= (testResult[0] = sdTest()); + t &= (testResult[1] = auxPinTest()); + t &= (testResult[2] = ethernetTest()); + t &= (testResult[3] = L6470Test()); + t &= (testResult[4] = dipSwTest()); + showHeader("Result of Hardware Test"); + p("SD Card: "); + showBoolResult(testResult[0]); + p("Auxiliary Pins: "); + showBoolResult(testResult[1]); + p("Ethernet: "); + showBoolResult(testResult[2]); + p("L6470: "); + showBoolResult(testResult[3]); + p("DIP switch: "); + showBoolResult(testResult[4]); + showTestResult(t); + storage.write(results); +} + +void loadResults() { + SerialUSB.println(F("================ Stored results ================")); + results = storage.read(); + SerialUSB.println(results); +} + +void loop() { + if (SerialUSB.available()>0) { + switch( SerialUSB.read() ) { + case 't': + hardwareTest(); + break; + case 's': + sdTest(); + break; + case 'l': + loadResults(); + break; + case 'd': + byte t = getDipSw(); + p("DIP SW: %d\n", t); + break; + } + } +} diff --git a/step800_hardware_tests/src/main.cpp b/step800_hardware_tests/src/main.cpp index c7a3395..52d40f7 100644 --- a/step800_hardware_tests/src/main.cpp +++ b/step800_hardware_tests/src/main.cpp @@ -21,17 +21,17 @@ FlashStorage(storage, String); #define SD_DETECT_PIN A4 #define ledPin 13u // L6470 - #define L6470_MISO 6 // D6 /SERCOM3/PAD[2] miso - #define L6470_MOSI 11 // D11/SERCOM3/PAD[0] mosi - #define L6470_SCK 12 // D12/SERCOM3/PAD[3] sck + #define L6470_MISO 6u // D6 /SERCOM3/PAD[2] miso + #define L6470_MOSI 11u // D11/SERCOM3/PAD[0] mosi + #define L6470_SCK 12u // D12/SERCOM3/PAD[3] sck #define L6470_CS_PIN A0 #define L6470_RESET_PIN A2 // Shift registers // 74HC165 +74HC595 for the dip sw input and the brake output - #define MISO3 3 // SERCOM2/PAD[1] - #define MOSI3 2 // SERCOM2/PAD[2] - #define SCK3 0 // SERCOM2/PAD[3] + #define MISO3 3u // SERCOM2/PAD[1] + #define MOSI3 2u // SERCOM2/PAD[2] + #define SCK3 0u // SERCOM2/PAD[3] #define LATCH3 A5 // Shift registers SPI extern SPIClass SPI3; @@ -41,7 +41,7 @@ FlashStorage(storage, String); #define SHIFTOUT_ENABLE_PIN 5u -const uint8_t auxPin[8] = {7,1,A1,6,9,38,SCL,SDA}; +const uint8_t auxPin[8] = {7u,1u,A1,6u,9u,38u,SCL,SDA}; #define NUM_OF_MOTOR (8) SPIClass L6470SPI(&sercom3, L6470_MISO, L6470_SCK, L6470_MOSI, SPI_PAD_0_SCK_3, SERCOM_RX_PAD_2);// MISO/SCK/MOSI pins @@ -224,6 +224,7 @@ bool ethernetTest() { // L6470 bool L6470Test() { + showHeader("L6470"); bool result = true; boolean L6470_reset_pin_enable_state = HIGH; pinMode(L6470_RESET_PIN, OUTPUT); @@ -415,6 +416,7 @@ bool dipSwTest() { } p("Done.\n"); } + showTestResult(true); return true; } From 1b45c63812e8463502596e3394bb7d7a9e19edcf Mon Sep 17 00:00:00 2001 From: Kanta HORIO Date: Fri, 16 Jul 2021 11:15:28 +0900 Subject: [PATCH 7/7] Update test_procedure.md --- step800_hardware_tests/test_procedure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/step800_hardware_tests/test_procedure.md b/step800_hardware_tests/test_procedure.md index 5cec9c3..7ad14a6 100644 --- a/step800_hardware_tests/test_procedure.md +++ b/step800_hardware_tests/test_procedure.md @@ -33,7 +33,7 @@ #### Download and Compile the test program -1. Download the program from [here](https://github.com/ponoor/STEP400/blob/master/hardwareTestSketch/hardwareTestSketch.ino), and open it with the Arduino IDE software. +1. Download the program from [here](https://github.com/ponoor/STEP800/blob/master/step800_hardware_tests/Arduino/step800_hardware_tests/step800_hardware_tests.ino), and open it with the Arduino IDE software. 2. Specify the target board as `Arduino Zero (Native USB Port)` . 3. Press the “VERIFY” button. Then Arduino IDE starts the compile the program (which called “Sketch” in the IDE).