ElectricMotorcycleForum.com

  • November 26, 2024, 02:26:39 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Electric Motorcycle Forum is live!

Pages: [1] 2

Author Topic: SR/F Serial/ODB2 connection to the BMS  (Read 1020 times)

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
SR/F Serial/ODB2 connection to the BMS
« on: February 28, 2021, 11:12:02 PM »

Hi All,

Has anyone an experience of talking to the SR/F BMS?

We have wired up a USB to TTL lead to an ODB2 plug on pins #9 (Tx), #8 (Rx) and #5 (Signal Earth).  The laptop is running PuTTY.  When connected to the SR/F and turning on the ignition, we do not get a 'prompt' followed by ZERO MBB.  What we get (immediately) is a stream of "DEBUG" statemenr:

DEBUG:   02/26/2021 11:30:31.465  ..\src\Application\zero_mbb_manage_bike.c       : line   521 - Key Sw = OFF
DEBUG:   02/26/2021 11:30:31.519  ..\src\Application\zero_mbb_manage_bike.c       : line   853 - Control flags changed. Old: 0x4036 New: 0x4038
         02/26/2021 11:30:31.521 - State change from STOP to HIB
      
ending with:
      
DEBUG:   02/26/2021 11:32:27.584  ..\src\Application\zero_mbb_manage_bike.c       : line   853 - Control flags changed. Old: 0x0038 New: 0x0030

Wven when the debug stream ends we still do not get a prompt, so we can't talk to the BMS to request data.

Has the BMS got stuck/set in debug mode?

Regards

Gary
Logged

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #1 on: March 01, 2021, 04:22:14 PM »

If you send the "help" command it will respond with all the options. I've been using Arduino IDE as a Serial Monitor. The bike doesn't have to be keyed on. If you key it ON you get those reports indeed. Those are normal.

Did you try sending commands? How so? On my original attempts I had the same issue where I could get read the messages but wasn't able to send any valid commands. Was fixed once I started using Arduino IDE so I didn't check what was the original problem.

Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #2 on: March 01, 2021, 04:43:33 PM »

Hi Hans2183,

I have been plugging my USB/TTL/ODB2 lead into the bike and laptop, running up PuTTY and keying on the bike.  The connection parameters are 115200,8,n,1,N.

The debug messages start immediately and when they finish, the square cursor returns to the left of the screen but the 'prompt' does not appear and the BMS ignores any keyboard commands so I cannot display the help screen.

I did not think to try the serial connection before keying on the bike.  I'll go and try it now.

Thanks Hans

Regards

Gary
Logged

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #3 on: March 01, 2021, 05:46:50 PM »

Hi Hans,

No, I still cannot get the bike to respond to keyboard commands.

I forgot to mention previously that the DEBUG code I listed has been cleaned up.  When it appeared in the PuTTY screen, it did not obey any CR/LF commands.  The code was all over the page.  I had to correct the layout to display the code nicely.

Some years ago I did use the Arduino IDE and a UNO board with some simple sketches just for interest.

Do you use a UNO board as the USB to TTL converter (using pins Tx and Rx) connected to the ODB2 plug?

I have looked at several serial sketches.  Will a simple serial sketch work or is there something specific needed to communicate with the bike?

Regards

Gary
Logged

ms_smart

  • Newbie
  • *
  • Posts: 49
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #4 on: March 01, 2021, 09:21:52 PM »

Hi Gary, are you running Windows? You may want to test Coolterm. Attached my config file. Obviously you need to change the com port. You need to type in Enter (or help + Enter as suggested by Hans) to get the prompt.

I am using a FT232RL based TTL to USB converter. I think I have the same one Hans is using in his video. I also tested a cheap fixed cable like this one: https://de.aliexpress.com/item/1005001587731393.html that can be soldered directly to a OBD2 socket, but you may get problems with the windows driver since the pl2303 chip is not genuine.

I also get sometimes debug messages, but not always. You can ignore them. Just type your command.

Logged

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #5 on: March 01, 2021, 10:13:07 PM »

Indeed is a cheap FT232RL chipset that I use, no arduino. Those are used to program arduino's that don't have this built in hence my original idea to test it with the Arduino IDE. You just need the serial monitor part of the IDE. That will likely resolve your issue. Coolterm might also work. I didn't try that.
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #6 on: March 01, 2021, 10:18:05 PM »

Hi ms_smart,

I'm running Linux Mint 19.3 (Tricia) on a nice, small netbook with the PuTTY programme.  My USB to TTL lead is also an FTDI IC device 'FT232RL'.  The problem I have is that the bike is talking to the laptop but not listening to the keyboard.  Han2183 mentioned a similar problem that he solved by using the Arduino IDE software.

Actually, I do have a windows based laptop.  It is a bit large and clunky but I will try using that with coolterm to see if that is a solution also.

Cheers

Gary
Logged

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #7 on: March 01, 2021, 10:24:49 PM »

Hi Hans,

OK, I get it.  Just plug the lead into the laptop and bike and select 'Serial Monitor' from The Arduino IDE's 'Tools' menu choice.

How do you set the connection parameters: 115200,8,n,1,N?

Cheers

Gary
Logged

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #8 on: March 02, 2021, 12:23:32 AM »

Hi Hans,

Found it. 

void setup()
{
  Serial.begin(115200);
}

void loop() {}

yes?

Cheers

Gary
Logged

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #9 on: March 02, 2021, 02:01:26 AM »

no you don't need to add any code in the sketch (unless you have an arduino that you want to program to listen on that port). When opening the serial monitor at the bottom there are some options for baud rate. For the device selection you have to pick the right one from the arduino IDE menu Tools > Port.
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #10 on: March 02, 2021, 05:18:31 AM »

Hi Hans,

Thank you for clarifying that.  I'll try the IDE to connect to the bike.

Regards

Gary
Logged

Auriga

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #11 on: March 02, 2021, 08:35:19 AM »

Hi Hans,

No, I still cannot get the bike to respond to keyboard commands.

I forgot to mention previously that the DEBUG code I listed has been cleaned up.  When it appeared in the PuTTY screen, it did not obey any CR/LF commands.  The code was all over the page.  I had to correct the layout to display the code nicely.

Some years ago I did use the Arduino IDE and a UNO board with some simple sketches just for interest.

Do you use a UNO board as the USB to TTL converter (using pins Tx and Rx) connected to the ODB2 plug?

I have looked at several serial sketches.  Will a simple serial sketch work or is there something specific needed to communicate with the bike?

Regards

Gary

Are you sending a carriage return + line feed on your serial messages? You have to on FST. Sometimes noted as /r/n.
Logged

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #12 on: March 02, 2021, 03:34:28 PM »

Hi Auriga,

That is a good point.  I'll check that.

Thanks

Gary
Logged

jjfinn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #13 on: March 02, 2021, 06:30:05 PM »

The problem is Putty cannot send  \r\n when you press Enter. Zero wants to have \r\n after each command to react. You need to do it manually after each command on the MBB console. E.g. "help" + Crtl-M + Ctrl-J. Here's the article: https://z49x2vmq.github.io/2017/11/12/putty-cr-lf-en/
Logged

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #14 on: March 02, 2021, 06:36:37 PM »

Hi jjfinn,

Brilliant.  Well done on finding that.  I'll try that on the bike tonight.

Cheers

Gary
Logged
Pages: [1] 2