Hi there,
I am working with a device which is connected to the CAN bus.
The goal is to power up the device in silent mode (when S pin at TJA1050 is HIGH). Then switch to normal mode by pulling S pin LOW by ESP32 in about 10 seconds.
To simplify everything, the board has the following: ESP32 (powered by 3.3V), TJA1050 transceiver (powered by 5V), power supply 5V, TLV1117LV33 voltage regulator.
ESP32's GPIO15 is connected to S pin of TJA1050 and it's pulled up (to 3.3V) with 10k resistor. Simple setup.
Right now when the board is powered up, the vehicle detects the device (or maybe there is a noise or something) and wakes up. I can hear that some relays are switching under the hood.
Datasheet for TJA1050 (https://www.nxp.com/docs/en/data-sheet/TJA1050.pdf) says that "The silent mode is selected by connecting pin S to VCC and can be used to prevent network communication".
Later it says that HIGH-level input voltage for S pin is from 2V to VCC + 0.3.
My assumption that 3.3V at the S pin should be enough.
ESP32 Wroover IO15 pin seems to be pin#21 in ESP32 datasheet, so it's input enabled at and after reset and also has weak pull-up. So, ESP32's startup should not interfere here.
The power up time of 3.3V regulator is 100 micro seconds.
There are also bypass capasitors, 1uF for voltage regulator and 0.1uF for transceiver as required by datasheets.
What I have tried:
- I reduced pull up resistor to 470 Ohm (still connected to 3.3V) - no success. The vehicle still detects power up of the device.
- When I used 10 kOhm pull up resistor to 5V - still does not work. Well, it works only the first time, but in about 60 seconds when the device is waking up again after power down, the relay starts to click.
- Switched pull up resistor to 670 Ohm and pull up to 5V. I am aware that I can damage ESP32. But this setup actually works.
Any idea what can be the issue and how I can fix it? I do not have oscilloscope, so I cannot confirm the time when S pin has it's high voltage in comparison with Vcc.
My thoughts:
- Use some kind of RC circuit modification to delay power up of the transciever?
- I was thinking about using a transistor to control the state of S switch, but cannot imagine how it will be.
Any ideas?
Thanks.
Well, made a couple of more tests.
Connecting sleep pin to 3V3 didn't help. I even disconnected it from the controller to avoid any startup fluctuations.
So, my understanding is that Sleep pin should be connected to the 5V immediately on power up.
Something like attached or I am overthinking it?
Maybe something like 2 to 1 line data multiplexer, like SN74HCT157DR, but with only one channel?
I have a SN74HCT157DR to test this idea. Unless there is a simpler solution.
If I understand all correctly, I would use a level shifter, which you can easily implement using a single bipolar or mosfet transistor and one resistor (look it up)
Hope it helps
senderene:
If I understand all correctly, I would use a level shifter, which you can easily implement using a single bipolar or mosfet transistor and one resistor (look it up)
Hope it helps
Yep, but with reverse logic.
When the control pin is LOW (and immediately during the controller startup), output should be 5V, when the control pin is 3V3, output should be 0.
It looks like a regular key, I just need to be sure that it will work this way. I'll try to draw a circuit to check the idea.
Something like this?
When the U2 control pin is LOW, silent pin will be 5V.
When the control pin is HIGH, the load to the controller pin is 0.3mA throught the R2 resistor. Q1 is opened, current goes through R1 and Q1, load is 7mA, silent pin will be LOW.
Is everything is correct? If so, what transistor I can use?
Put a series resistor (you can try 1k) between "U2 control 3V3" pin and the base of that transistor.
You can remove the R2.
You can make R1 10K.
You can use any general purpose npn transistor (2N2222, etc)
Thank you for your advice!
Got it about resistor for the base and without R2.
Can you recommend 2N2222 analog as SMD?
I have a BSS138W for a test, is it ok to use it as a key in this circuit? Any disadvantages (maybe the price)?
I found here that Gate threshold voltage is 1.4. Not sure if this is the maximum that should be applied to the gate or this is the max voltage when it opens.
Thanks.
An update.
I've soldered everything according my recent scheme. Everything works fine.
Not sure if this is the ideal solution (I would prefer not to waste current through 680Ohm resistor, 7.5mA, but still..), but it works.
As for my question about Vgs - this MOSFET allows up to 20V difference (here is the info the datasheet at the first page "Maximum Ratings @25 degrees C").