MaslowCNC / Firmware

Maslow Firmware
GNU General Public License v3.0
263 stars 133 forks source link

Added version 4 #502

Closed MarcinanProfesjonalista closed 5 years ago

MarcinanProfesjonalista commented 5 years ago

Here is link to thread https://forums.maslowcnc.com/t/managing-motors-with-dual-l298n/9896 Here is link to new shield prepared under DIY and external H bridges for people that need more current for their motors.
https://easyeda.com/polaski/maslow-cnc-shield-v2

I need to change attach version pins on board at the moment, so please write your suggestion on forum.

MaslowCommunityGardenRobot commented 5 years ago

Congratulations on the pull request @MarcinanBarbarzynca

Now we need to decide as a community if we want to integrate these changes. You should vote by giving this comment a thumbs up or a thumbs down. Votes are counted in 48 hours. Ties will not be merged.

I'm just a robot, but I love to see people contributing so I'm going vote thumbs up (but my vote won't count...)!

BarbourSmith commented 5 years ago

It looks like the lint check is complaining with error:

System.cpp:240:5: error: 'else' without a previous 'if'

Which I think is caused by the else statement on 206 being followed by theif else further down, I believe that the last statement needs to be else.

I really like what you have done with making it possible to use a stand alone L298N board. Are you want to use a custom board version instead of matching the inputs to one of the existing ones? If you feel like you really need to go that route it's OK by me.

blurfl commented 5 years ago

I can't remember the specific reason, but I know that the present firmware is crafted to avoid using D11, D12 or D13 as a PWM pin. That could give you trouble. Look at Motor::write() to see what I mean.

It would take some reworking the PCB, but using the same pin definitions for the L298 chip signals as the version 1 or version 2 board would make the software modifications much easier. No changes would be needed for Motor.cpp, for instance, and that's where the tricky parts are.

davidelang commented 5 years ago

The existing versions are based around if there is one direction pin and an enable pin to pulse or if there are different enable pins for each direction

David Lang

esspe2 commented 5 years ago

Maybe you have to fetch the last version of the firmware: with the PR #499, the test on the version 1.3 has been removed, so it has to be put back with a last else for your 4th version:

Before:

else { // (pcbVersion == 3) // TLE5206
    //TLE5206 PCB v1.3 Detected
   ( ... )
}

After:

else if (pcbVersion == 3){ // TLE5206
    //TLE5206 PCB v1.3 Detected
    ( ... )
}
else { // (pcbVersion == 4){//version not assigned
    //DIY motor shield for external H bridges.  
    (...)
}

Edit: don't forget to change getPCBVersion() accordingly.

MarcinanProfesjonalista commented 5 years ago

I can't remember the specific reason, but I know that the present firmware is crafted to avoid using D11, D12 or D13 as a PWM pin. That could give you trouble. Look at Motor::write() to see what I mean.

It would take some reworking the PCB, but using the same pin definitions for the L298 chip signals as the version 1 or version 2 board would make the software modifications much easier. No changes would be needed for Motor.cpp, for instance, and that's where the tricky parts are.

Ok. Ill try to prepare new prototype for that :P

blurfl commented 5 years ago

PCB creation, software crafting, learning to use github, there's a lot of tasks to making a new board, it's an exciting process and you're making a good contribution, but there's a bit more work to do before this is ready for a PR. ;) I think that the best way to do it is to wait until the whole thing - board and firmware - are made and tested and found to work, then create the PR. Before then, push your changes to your own fork, keep your own master current with the upstream master, and when all the coding is done with no more 'little touches' to take care of, then it will be time.

MarcinanProfesjonalista commented 5 years ago

I need to know witch pins are connected to make it 1.2 Version board. Give me 2 H to make new PCB

esspe2 commented 5 years ago

Why is there already some mention of a 1.4 board before your mod? You may have to rename yours to "1.5" because getPCBVersion()  comments are rather confusing.between 1.3 and 1.4, someone please correct me if I'm wrong.

I think that the CI (failed)check is based on the latest version, but you started from before the PR #499. So it doesn't understand which version of line 206 you have, and doesn't put back the if.

Do something like : save all your work, git fetch origin, git branch board1.5, copy your work, make another PR. Or does some Git guru know a better way?

MarcinanProfesjonalista commented 5 years ago

Here is DIY version 1.2 https://easyeda.com/polaski/maslow-diy-1-2-shield-for-external-h-drivers

There is description witch pins connect to 5v and GND to get version 1.2, I don't understand it :(

esspe2 commented 5 years ago

Here is some info for the pins of the documented board which is named "V1.2b": From Config.h:

// Define version detect pins
#define VERS1 22
#define VERS2 23
#define VERS3 24
#define VERS4 25
#define VERS5 26
#define VERS6 27

Looking at: https://raw.githubusercontent.com/MaslowCNC/Electronics/master/PowerDistributionBoardSchematic.PNG

By chance pins pullups are defined in getPCBVersion(), which means:

VERS1==1 (used)
VERS2==1 (used)
VERS3==1 (unconnected ??)
VERS4==1 (unconnected ??)
VERS5==1 (unconnected ??)
VERS6==1 (unconnected ??)
PIN52==0 (unused ??)
PIN53==0 (unused ??)

I replicated the JP3 JP4 connexions on my prototype, which seems to work, but I feel that something has to be done about those pins 52&53, maybe you should connect them to the ground too.

blurfl commented 5 years ago

Here is DIY version 1.2

That will make your life very much easier - you shouldn't need to make any changes to Motors.cpp with this new layout. 💯 This is a great example of a hardware solution ~solving~ eliminating a scaly software issue :P

There is description witch pins connect to 5v and GND to get version 1.2

Here's my understanding:

On the original Maslow L298P boards, 
D22-D23 and D52-D53 on XIO were used to 
indicate the board revision number in binary. 
The software read these pins and detect the 
shield version.

#53-#52           #23-#22
-------           -------
GND-GND           GND-5V  -> rev.0001
GND-GND           5V-GND  -> rev.0002
GND-GND           5V-5V   -> rev.0003

Because D52 and D53 are used for 
SPI, newer boards should uses D22-D27.

#27-#26  #25-#24  #23-#22
-------  -------  -------
GND-GND  GND-5V   GND-GND -> rev 1.3. TLE5206
GND-GND  GND-5V   GND-5V  -> rev 1.4
GND-GND  GND-5V   5V -5V  -> rev 1.5  TLE9201 

You'll still need a version 1.4 definition, though, to get your AUX pin definitions. I didn't look to see whether your INCnA and INCnB pins match 1.2, but those will get handled by your 1.4 section as well. I don't think you would need any other changes to the firmware.

esspe2 commented 5 years ago

Thanks @blurfl , I was wondering what happened to the pins #53-#52. Awww I see: duel between identification and SPI : "this town ain't big enough for the both of us".

Winner : SPI !

But is it the end ? Maybe we still could use them in the version check AND afterwards for SPI if needed, I have some ideas. OK, SPI SS/SCK pins are used without running the controller, so no check would do the trick.

MarcinanProfesjonalista commented 5 years ago

Here is my version 1.4 board. https://docs.google.com/document/d/1dOIk3eNJ1dNO3xcWViaV02fj7BChyFAuJ0R7hZSsiss/edit?usp=sharing https://easyeda.com/polaski/maslow-cnc-shield-v2 I updated pinouts

Here is my version 1.2 board: https://easyeda.com/polaski/maslow-diy-1-2-shield-for-external-h-drivers

Here are description how to make one. (it still uses old pictures, when i made 1st prototype). https://docs.google.com/document/d/1Wpc170mOkvBkJqCRWKsikC4eK_wcvOzLPOi6yunFxas/edit When I will get motors and router from china (60 days) I will try to make 7-10 cnc mashines one by one.

blurfl commented 5 years ago

Making great progress 👍🏻 If you're open to one more suggestion, instead of using the 5V supply pin of the Arduino, use the IOREF pin. The IOREF pin is internally tied to the 5V supply on Arduinos that use 5V, and tied to the 3.3V supply on Arduinos and compatibles that can be damaged by 5V on the inputs (Arduino Due, Teensy 3.6, Grand Central Metro). With that change, the boards would would work with the MaslowDue firmware with very few software changes. It's a hardware change that opens up software options.

MarcinanProfesjonalista commented 5 years ago

Soo. What do You all think... Shall i get DIY version as 1.4? I connected version pins as blurfl suggested. Now we have 1.4 with 9 AUX pins and 1.2 with 6 aux. I can't push my commit with 1.4 update :|. On Arduino IDE i can upload main Maslow program, but when i try my own it gets some EEPROM error "internal compiler error: Segmentation fault". When i replace version 3 with my code it works normally.

OK I now see that IOREF pin. Its top over Reset pin. Now IOREF is used as 5v source for encoder.

blurfl commented 5 years ago

Soo. What do You all think...

Your v1.2 board looks like it will run using the stock releases of firmware, which is a big plus for supporting users who are more comfortable with woodworking than with firmware versioning.

I'd suggest that you develop your v1.4 board on your own fork of the firmware and wait to merge it here until you've done more with it there.

At this point, this PR only seems to modify some of the whitespace in the System.cpp file. Perhaps it should be closed?

MarcinanProfesjonalista commented 5 years ago

Ye. I need to get rid my versioning. I will lock my self in 1.2 version for while, because I need to learn how to interact with github. I will prepare better guide, maybe video on "How to make Your Maslow 1.2 cnc shield for 15$" (10$ for h bridges + 5$ for other parts)

The version 1.4 witch 9 AUX is ready to get own place in System.cpp, but i wont post it (conflicts + warnings xD). https://docs.google.com/document/d/1dOIk3eNJ1dNO3xcWViaV02fj7BChyFAuJ0R7hZSsiss/edit <The pinouts will stay the same for probably 6 months

blurfl commented 5 years ago

There's a lot to learn with github :) Your v1.2 board looks like it will make it very easy for someone to make. Great contributions!

BarbourSmith commented 5 years ago

Excellent progress! I think a write up on how to build a DIY shield cheaply would be an awesome thing for the community. I know you are not alone in wanting that so hopefully you can save someone else the hassle of having to work it all out.

Jumping way back in the conversation:

I can't remember the specific reason, but I know that the present firmware is crafted to avoid using D11, D12 or D13 as a PWM pin. That could give you trouble. Look at Motor::write() to see what I mean.

Those pins use the same timers that we use to trigger some of our internal calculations to generate their PWM signals and so the PWM signals are not reliable on those pins. What you've done with using the 1.2 pinout is the right way to go. That is the best pinout we've found so far.