sterretje:
Were your calculations based on that? I have old designs (NE555 based) that advise around 100Hz. Lower will result in a humming engine, higher will result in too much heat; I guess you know that 
Actually no I don't, i just pulled it out of my ass as a ballpark "minimum acceptable" figure.
It looks like my concern about synchronizing the PWM signals was unnecessary. When I tried some bog-standard analogWrite()s on my Mega all the pulses were perfectly in sync on my 'scope provided the PWM values for each pin were the same. For example analogWrite(110); to each pin being tested.
I guess it is possible that something in a real program might upset this and I will need to remember to check.
...R
There's a few things that would probably knock them out of sync:
- Changing the prescalers.
- Disabling timers with the Power Reduction Register.
- Directly overwriting the timer value register.
Avoid those things and you should be fine.
The problem is that a Mega only has 16 PWM outputs. That's not enough to run 10 sections of track with 2 inputs each. Multiple micros are probably not going to be easy to sync between, not as easy as the PCA chip from Adafruit would be if you fed the chips with an external clock.
One solution is to run one PWM and one non-PWM to each H-bridge. Set the non-PWM to LOW and use analogWrite(speed) for one direction, and set the non-PWM HIGH and analogWrite(255-speed) for the other direction.
There is a slight problem with this setup. In the first direction, LOW-LOW is the off state and in the second it's HIGH-HIGH. For the H-bridge you selected these states are not identical. LOW-LOW puts the outputs to High-Z (stop mode in the table), and HIGH-HIGH makes them both LOW outputs (brake mode). Brake mode will be more forceful than stop mode, which may become significant at lower speeds. So there's a chance there that with this wiring the trains will act differently depending on which polarity is applied to the track. It also might not, you'd need to test that to see if it has a significant effect.
If it is a big deal, then the solution is to have a dual 2-to-1 multiplexer circuit before the H-bridge to act as a crossover. This would let you switch which input the PWM signal is applied to. All I found on Mouser were quad circuits, but it's not a big deal just not using half of them. Something like this 74HC157 is suitable for that. Note that you would not be able to use 1 of these for 2 sections, because all 4 selectors are controlled by one pin.
To summarize, here are what I would consider to be your good options:
- External PWM generation chips like the Adafruit PCA board or the TI TLC chip.
- A Mega, which may need the 74HC157 crossovers like I mentioned above.
- If this is a common enough problem, a CPLD or FPGA could be programmed to perform the controller routing and possibly even the PWM generation all in one chip. This is exactly the kind of project that one would be good for. The learning curve would be really steep though.