ElectricMotorcycleForum.com

  • November 02, 2024, 07:36:45 PM
  • 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 1013 times)

ninja62

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #15 on: March 02, 2021, 07:44:06 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/


You can configure putty to send CR+LF automatically in the configuration window, Terminal section. Just tick both 'Implicit CR in every LF' and 'Implicit LF in every CF'. ;)
Logged
# Riccardo # ZERO FX MY2020

Gary

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

Hi All,

Using PuTTY and Mttty I can connect to the SR/F (at last!).  Herewith the process and the results I achieved:

1.  DO NOT key on the bike
2.  Plugin the USB connector into the laptop
3.  Plugin the OBDII connector into the SR/F
4.  Run up PuTTY
5.  Set 115200,8,n,1,N and hit connect

The cursor will just sit at the left hand edge of the PuTTY window
6.  Now enter Ctrl + m
7.  Now enter Ctrl + j

The SR/F will wake up and reply:
ZERO MBB>

8.  Type in 'help' (without the ' symbols)
9.  Now enter Ctrl + m
10. Now enter Ctrl + j

The SR/F will reply:
ZERO MBB> help

*************************************************************
                                                             *                 Main Menu                           *
                                    *************************************************************

                   help            - Display this Help screen
                                                               login           - Display login level, or login

                                -- MBB Operational Information --
                                                                   version         - Board and firmware revision
                                  dash version    - Dash and Telit firmware revision
      time            - Current time
                                      in              - State of all inputs
                                                                             faults          - Active faults (-v for verbose)
                                               notif           - Active notifications
       stats           - All statistics


=====================================================================

As you can see, the information is there, it is just difficult to read.  The SR/F does not appear to send CR/LF's

Cleaning up the poor formatting give this:


*************************************************************
*                 Main Menu                           *
*************************************************************

help            - Display this Help screen
login           - Display login level, or login

-- MBB Operational Information --
version         - Board and firmware revision
dash version    - Dash and Telit firmware revision
time            - Current time
in              - State of all inputs
faults          - Active faults (-v for verbose)
notif           - Active notifications
stats           - All statistics

Any ideas on how to fix this?

Cheers

Gary
Logged

Gary

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

Hi Ninja62,

The penny has just dropped.  I only selected 'Implicit LF in every CF'.  I forgot the 'Implicit CR in every LF'.  OK, back out to the bike now.

Cheers

Gary
Logged

karlh

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #18 on: March 07, 2021, 11:28:42 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?

Gary

Gary,

I understand your connection parameters except for the final N.  What does that represent?
Logged
Karl
2020 SR/S
2007 BMW R1200ST
1978 Triumph Bonneville

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #19 on: March 09, 2021, 11:28:59 PM »

Hi Karlh,

The final 'N' refers to the flow control, so set this to 'None'.

Cheers

Gary
Logged

karlh

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #20 on: March 09, 2021, 11:45:17 PM »

Thanks.  You don't often see that listed with the other parameters.
Logged
Karl
2020 SR/S
2007 BMW R1200ST
1978 Triumph Bonneville

Gary

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #21 on: March 23, 2021, 06:32:08 PM »

Hi All,

Results of access tests via a Linux laptop

==================================

LINUX MINT 19.3 (TRICIA)
 
PUTTY - Set up the configuration as follows:

Category: Terminal
- tick 'implicit CR in every LF'
- tick 'implicit LF in every CR'

NOTE:  This ensures that the returned text is correctly formatted.

Category: Connection/Serial
- Serial Line to connect to: /dev/ttyUSB0
- Speed: 115200
- Data: 8
- Stop: 1
- Parity: None
- Flow Control: None
 
Click on 'Category: Session'
Click on 'Serial', a radio button
In 'Saved Sessions' click on 'Default Settings'.
Click on 'Save'

 PUTTY METHOD#1
Open:  a Terminal window
Type:  'sudo chmod -R 777 /dev/ttyUSB0'
Enter: [password]
Type:  'sudo putty'
Select 'Open'
Enter: 'CTRL + m' then 'CTRL + j' to wake up the Zero MBB and display the '>'.
After each entry, ie, 'help', finish with 'CTRL + m' then 'CTRL + j' to make the MBB respond.

 PUTTY METHOD#2 - I forgot to try this one!
By default, PuTTY sends the Telnet New Line code when you press Return, instead of sending Control-M as it does in most other protocols. 
PuTTY emulates xterm which emulates vt100. To have putty send CR/LF when pressing enter, type ESC[20h in putty after connecting to the serial device. This sets VT100 LNM true.
 
 PUTTY METHOD#3
Sending CR+LF is possible in modified PuTTY. Source code is available at https://github.com/gniemirowski/putty-crlf and Windows binary at https://www.grzegorz.net/pliki/putty-crlf.zip When you run this version just go to Terminal -> Keyboard and select "CR LF" for "The Enter key" option.
 
===========================================
'CTRL + m'   CR  13 or 0D
'CTRL + j'  LF  10 or 0A
===========================================
COOLTERM

http://freeware.the-meiers.org/CoolTermLinux32Bit.zip

Open:  a Terminal window
Type:  'sudo chmod -R 777 /dev/ttyUSB0'
Enter: [password]
Run CoolTerm
- Speed: 115200
- Data: 8
- Stop: 1
- Parity: None
- Flow Control: None
Select Connect

===========================================
INSTALL PUTTY CR-LF

1.  Delete all the putty files from any previous install attempts on the laptop, if exist.
2.  sudo apt-get install build-essential libgtk-3-dev
3.  git clone https://github.com/gniemirowski/putty-crlf
cd putty-crlf
./mkauto.sh
./configure --disable-git-commit
make
4.  Run new putty-crlf:
cd putty-crlf
./putty

===========================================
CREATE BASH SCRIPT - serial.sh

path to serial.sh: /home/username/

touch /path/to/serial.sh
chmod a+x /path/to/script.sh
'mcedit /path/to/script.sh' and paste this code:

#!/bin/sh
echo logan | sudo -S chmod -R 777 /dev/ttyUSB0
/path/to/putty-crlf/putty

==========================================
TERMINAL
/home/username/serial.sh

LAUNCHER
/home/username/serial.sh
==========================================

I hope the above is of use to you.  Whatever method I use, I always have to enter ctrl+m and ctrl+j after each command to get the MBB to respond.  I don't know why.  I maybe a Linux thing.  I'm going to try the above using a windows 10 laptop.  I'll let you know how I get on.  Thanks to all of you for your help on this forum.

Cheers

Gary
Logged

Auriga

  • Sr. Member
  • ****
  • Posts: 391
    • View Profile
Re: SR/F Serial/ODB2 connection to the BMS
« Reply #22 on: March 24, 2021, 02:15:13 AM »

I've always preferred screen or minicom over putty on linux. Zero itself seems to primarily use Teraterm on windows, and that's what they have us use as well.
Logged

Gary

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

Hi Auriga,

Thanks for the info.  I'll try those products

Cheers

Gary
Logged
Pages: 1 [2]