I'm afraid I've accidentally burned the PWM spindle output. Now the output is fixed at 150 mV whatever settings I choose. By the way, these are my current settings:
[p1frq] pwm frequency 1000 Hz
[p1csl] pwm cw speed lo 0 RPM
[p1csh] pwm cw speed hi 1000 RPM
[p1cpl] pwm cw phase lo 0.000 [0..1]
[p1cph] pwm cw phase hi 1.000 [0..1]
[p1wsl] pwm ccw speed lo 0 RPM
[p1wsh] pwm ccw speed hi 1000 RPM
[p1wpl] pwm ccw phase lo 0.000 [0..1]
[p1wph] pwm ccw phase hi 1.000 [0..1]
[p1pof] pwm phase off 0.000 [0..1]
I would be able to replace the MCU and flash the bootloader, but I need to disconnect everything and the case is not easily accessible. I wonder if there is a way to use a different pin to output a PWM.
I gave a quick look to the code and I see there is a "secondary" PWM that seems not used.
Anyone who says "I would be able to replace the MCU and flash the bootloader" immediately gets a bit of questioning respect, please don't be offended:
We are talking tinyG, not G2core(DUE), correct?
Interface did work for you with the settings you attach?
They look OK, but I have never seen anyone set speed hi to 1000 RPM.
I am not a developer, but have seen reference to PWM2 on G2Core.
Looking in tinyG/pwm.c, I do see reference to PWM2, but in an ifdef __ARM block, which is DUE code (common code base), I believe.
Assuming an 'electrical event' damaged the I/0 port pin hardware, are you thinking using a different output port on the XMEGA?
Which one?
I am not sure there are any unused Ports.
Schematics here
I'm not offended at all. I'm quite new to tinyG (yes, tinyG, not G2) and perhaps I might be wrong but as far as I understand the project is opensource. Hence, it should be enough to de-solder the xmega and replace it with a new one (which I have in my drawers) and using AtmelStudio to flash the hex of the bootloader before download the latest firmware. Is it correct?
Yes, the PWM worked a while without any connection on the terminal blocks. I'm pretty sure I accidentally connected the wrong wire (it was too early in the morning, gh...). The spindle pin works fine but I don't understand your question: it's on a different port (PA5). It would be more useful to know if other pins of PORTD still work, wouldn't it? Anyway, they seem to work...
About my question: I'm not talking of spare pins, but "unused" ones in my application. Example, from here: https://github.com/synthetos/TinyG/blob/master/firmware/tinyg/pwm.c#L67 it seems the spindle PWM comes from the CCB of TCD1 (PD5). From the schematic the coolant (PE5) is instead CCB of TCE1.
I’m not offended at all. I’m quite new to tinyG (yes, tinyG, not G2) and perhaps I might be wrong but as far as I understand the project is opensource. Hence, it should be enough to de-solder the xmega and replace it with a new one (which I have in my drawers) and using AtmelStudio to flash the hex of the bootloader before download the latest firmware. Is it correct?
You are Correct.
The tooling and skills required for this is not typical for Forum users, including myself.
Yes, the PWM worked a while without any connection on the terminal blocks. I’m pretty sure I accidentally connected the wrong wire (it was too early in the morning, gh…). The spindle pin works fine but I don’t understand your question: it’s on a different port (PA5). It would be more useful to know if other pins of PORTD still work, wouldn’t it? Anyway, they seem to work…
That question had two motivations. 1, determine if you knew how to turn PWM on and off. Obviously, you do. 2, Get a rough feel for how much damage to the I/O structure on the XMEGA had been done. I fully agree that determining functionality on Port D would be a good thing before proceeding. As well as looking at chip physical layout to see what else might be in the vicinity of the Port D5 output structure.
Here is a good reference if you don't already have it
Is the Coolant I/O pin functional? If so, and not used by your application, recompiling with the PWM connected to the Coolant external port might be your quickest try.
Very few Forum users are equipped to handle the gory details of recompile tinyG, folks off on that tangent do tend to head directly to the Issues interface for advice.
It is not a question of off-topic, more that you might attract input from other tinyG users working at the recompile level over at Issues, as well as the developers.
If your Coolant lead is still functional, give it a go.
Mark81 - No surprise to you,
I was able to install the binary to my test platform with avrdude and verify the swap of Coolant (M8) and SpinPWM ports works.
Thanks again.
For anyone reading this thread, the binary Mark81 built still reports $fb=440.20, exercise care if you download it.
This topic is from the original forum (September 2017). Your reply starts a new discussion linked to it.