PWM Control MS3PRO to TinyIOx over CAN
Moderators: jsmcortina, muythaibxr
-
- Helpful MS/Extra'er
- Posts: 51
- Joined: Fri Nov 29, 2013 9:07 pm
PWM Control MS3PRO to TinyIOx over CAN
1) Select TinyIOx Setup in the TunerStudio toolbar
2) In "Base I/O settings, enable PWM Outputs. Burn
3) Select "Port Settings" and set up one port each for PTDO and PTD1 as port outputs, and Single Value (PWM output). Burn
4) Select "PWM Output Settings", and enable PTD0 and PTD1. Burn
5) Select Extended Control tab on the TS toolbar
6) Select "Programmable On/Off Outputs Selection (CANx)"
7) Set Channel 1 to PTD0, Channel 2 to PTD1. Burn
8 ) Select "Programmable on/Off Outputs"
9) Select appropriate activation options for each channel. Burn.
As far as using the TinyIOx with 12v warning lights, its wired according to what's shown in 3.5.7, in the MS3(base) HW Guide.
This about right?
You do not have the required permissions to view the files attached to this post.
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: PWM Control MS3PRO to TinyIOx over CAN
The way you have it shown, you are creating a conflict. You either want to use the pins as PWM outputs or as programmable on/off outputs, not both since these are 2 different options (PWM or on/off). Since you want to use the PWM outputs, disable the on/off outputs.
Also, the way you have it set up means that you want the MS3 to control the PWM duty cycle. And you have the PWM frequency set to 24MHz because the PWM outputs use the timer 2 and, as you can see in the first window, you're using the 24MHz clock with a prescale of 1.
You will then need to use the MS3 generic PWM outputs and set the CAN parameters. Please let me know what signals you want to be used for controlling the PWM duty cycle, what PWM frequency would make sense for your setup, and I can guide you on what to set next.
And the circuit in 3.5.7 is the correct one.
Jean
Also, the way you have it set up means that you want the MS3 to control the PWM duty cycle. And you have the PWM frequency set to 24MHz because the PWM outputs use the timer 2 and, as you can see in the first window, you're using the 24MHz clock with a prescale of 1.
You will then need to use the MS3 generic PWM outputs and set the CAN parameters. Please let me know what signals you want to be used for controlling the PWM duty cycle, what PWM frequency would make sense for your setup, and I can guide you on what to set next.
And the circuit in 3.5.7 is the correct one.
Jean
-
- Helpful MS/Extra'er
- Posts: 51
- Joined: Fri Nov 29, 2013 9:07 pm
Re: PWM Control MS3PRO to TinyIOx over CAN
Jean,
Thanks for reviewing this. Yes, I see the Programmable I/O PWM conflict. I didn't change the PWM settings, as I wasn't quite sure where to go with them. The intent was only to use the PWMs to drive light outputs.
I should have been clearer on what I want to do here. The objective is to set up warnings for low oil/AT fluid pressures, as well as adding a shift light, via TinyIOx. This car is going to be more of a day track car than a street car. I am more inclined to utilize a 12v 100 ish dB buzzer, than a light to provide the low pressure warning. I used all the PWM outs on the MS3Pro, so I want to use the two on the IOx.
Which leads me my other question. Can I use the PTE2 / PTE3 outputs to drive either a 12v led or a piezo buzzer? Which conditioning circuit would I need?
Thanks for reviewing this. Yes, I see the Programmable I/O PWM conflict. I didn't change the PWM settings, as I wasn't quite sure where to go with them. The intent was only to use the PWMs to drive light outputs.
I should have been clearer on what I want to do here. The objective is to set up warnings for low oil/AT fluid pressures, as well as adding a shift light, via TinyIOx. This car is going to be more of a day track car than a street car. I am more inclined to utilize a 12v 100 ish dB buzzer, than a light to provide the low pressure warning. I used all the PWM outs on the MS3Pro, so I want to use the two on the IOx.
Which leads me my other question. Can I use the PTE2 / PTE3 outputs to drive either a 12v led or a piezo buzzer? Which conditioning circuit would I need?
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: PWM Control MS3PRO to TinyIOx over CAN
If only want to use a light or a LED, you actually don't need a PWM output but simply and on/off output. For that, you can use PTE2/PTE3. If you want to use a buzzer, you will need to use a PWM output set to around 1kHz and have the duty cycle set to 50% when a variable threshold is reached and 0 otherwise. As for the circuit, you can use the same circuit as mentioned before (circuit shown in 3.5.7 of the manual; use a TIP122 for device drawing up to 5A and use a PN2222A for devices drawing up to 0.5A).
I'll come back with more details on how to set both the on/off output and the PWM output. I need to open TunerStudio with a dummy project and do a few screen captures. I'll keep the settings all on the TIOx because everything needed is available there and it will be simpler (in my opinion).
Jean
I'll come back with more details on how to set both the on/off output and the PWM output. I need to open TunerStudio with a dummy project and do a few screen captures. I'll keep the settings all on the TIOx because everything needed is available there and it will be simpler (in my opinion).
Jean
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: PWM Control MS3PRO to TinyIOx over CAN
The following assumes that you have a TunerStudio project set with your MS3 as the main controller with the TIOx as a CAN device. If you're not sure what that means let me know but basically you have an MS3 project and you have added a TIOx on the CAN device section of the project properties.
To set the PWM frequency at about 1kHz, you will need to set the timer 2 clock and prescale:
The frequency will be 1MHz (clock source) divided by 256 (8-bit PWM) divided by 4 (prescale) = 976.5625Hz. If you want a different frequency (different pitch), you can change those. And you do not need to enable the digital I/Os or the PWM outputs because that's only needed when the MS3 controls the I/Os over CAN: this is not the method I have described below.
For setting up the PWM output, you will need to configure one of the generic PWM outputs. This is an example of how it could be set:
The location of the load data is on the MS3 and the load axis is the data you want to use to control the buzzer. The load axis is a list of all the data available from the MS3 datalog; the names are from the ini file so they may not be all very intuitive. You also need to set this to a curve instead of a table. In the example, I have set this to have the buzzer turn on at 205 and off at 204 because the duty cycle is interpolated so you don't want to have a large interval; unfortunately that means no hysteresis.
With this the TIOx will request the data from the MS3 over the CAN bus and activate the PWM accordingly.
For the warning light, you want to configure a programmable on/off output:
Again you can use data from the MS3 which will be requested by the TIOx over the CAN bus. You can have up to 3 conditions to turn on/off the output.
Let me know if anything needs clarifying.
Jean
To set the PWM frequency at about 1kHz, you will need to set the timer 2 clock and prescale:
The frequency will be 1MHz (clock source) divided by 256 (8-bit PWM) divided by 4 (prescale) = 976.5625Hz. If you want a different frequency (different pitch), you can change those. And you do not need to enable the digital I/Os or the PWM outputs because that's only needed when the MS3 controls the I/Os over CAN: this is not the method I have described below.
For setting up the PWM output, you will need to configure one of the generic PWM outputs. This is an example of how it could be set:
The location of the load data is on the MS3 and the load axis is the data you want to use to control the buzzer. The load axis is a list of all the data available from the MS3 datalog; the names are from the ini file so they may not be all very intuitive. You also need to set this to a curve instead of a table. In the example, I have set this to have the buzzer turn on at 205 and off at 204 because the duty cycle is interpolated so you don't want to have a large interval; unfortunately that means no hysteresis.
With this the TIOx will request the data from the MS3 over the CAN bus and activate the PWM accordingly.
For the warning light, you want to configure a programmable on/off output:
Again you can use data from the MS3 which will be requested by the TIOx over the CAN bus. You can have up to 3 conditions to turn on/off the output.
Let me know if anything needs clarifying.
Jean
You do not have the required permissions to view the files attached to this post.
-
- Helpful MS/Extra'er
- Posts: 51
- Joined: Fri Nov 29, 2013 9:07 pm
Re: PWM Control MS3PRO to TinyIOx over CAN
Awesome, thanks Jean....
I will set this up on the MS3/3X I am now using as a bench tester. I am awaiting delivery of the necessary components to wire up to the TinyIOx.
I will set this up on the MS3/3X I am now using as a bench tester. I am awaiting delivery of the necessary components to wire up to the TinyIOx.
-
- Helpful MS/Extra'er
- Posts: 51
- Joined: Fri Nov 29, 2013 9:07 pm
Re: PWM Control MS3PRO to TinyIOx over CAN
As described by Jean, confirmed that the warning light setup works...on to the PWM controlled buzzer.
-
- Helpful MS/Extra'er
- Posts: 51
- Joined: Fri Nov 29, 2013 9:07 pm
Re: PWM Control MS3PRO to TinyIOx over CAN
Jean,
I am seeing unusual behavior on the PTE2/3 pins. I set two triggers on PTE3, but when CLT is over the 75 F threshold, the LED does not light up. It does when I move my TPS past 30%, despite it's threshold set at 20%. I "believe" the CAN parameters are set correctly. The circuit seems to be correct, given the LED does light up ( on the TPS trigger). Do you something wrong in my setup? The TinyIOx firmware did update correctly.
I am seeing unusual behavior on the PTE2/3 pins. I set two triggers on PTE3, but when CLT is over the 75 F threshold, the LED does not light up. It does when I move my TPS past 30%, despite it's threshold set at 20%. I "believe" the CAN parameters are set correctly. The circuit seems to be correct, given the LED does light up ( on the TPS trigger). Do you something wrong in my setup? The TinyIOx firmware did update correctly.
You do not have the required permissions to view the files attached to this post.
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: PWM Control MS3PRO to TinyIOx over CAN
I will need to see the TinyIOx msq because there is nothing in the MS3 msq you posted (nothing CAN related). I will also need to see a datalog which shows the issue with both MS3 and TIOx data related to the issue.
Jean
Jean
-
- Helpful MS/Extra'er
- Posts: 51
- Joined: Fri Nov 29, 2013 9:07 pm
Re: PWM Control MS3PRO to TinyIOx over CAN
Jean,
Disregard. I found the problem today, and it was on my end. I have 2 LEDs on PTE2 & 3 working. My error was not performing a hard ECU reset (actually powering it off). Resetting the ECU using the Engine Control function does not work. Lesson learned.
That being said, given that most of the pins can be used as digital I/Os, how would I set the board up to enable add'l outputs?
Can I enable PTE4 and 5 as programmable inputs as shown above, and use both similarly to PTE2/3?
Disregard. I found the problem today, and it was on my end. I have 2 LEDs on PTE2 & 3 working. My error was not performing a hard ECU reset (actually powering it off). Resetting the ECU using the Engine Control function does not work. Lesson learned.
That being said, given that most of the pins can be used as digital I/Os, how would I set the board up to enable add'l outputs?
Can I enable PTE4 and 5 as programmable inputs as shown above, and use both similarly to PTE2/3?
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: PWM Control MS3PRO to TinyIOx over CAN
Did you mean programmable outputs instead of inputs? If so, then yes you can set PTE4 and 5 as programmable outputs the same way as PTE2 and 3. You can use any pin or virtual I/O shown in the pull down menu in the output selection window.
Jean
Jean