Jump to content

On Error in CAN V2 Brick reset or restart Brick (in Python)


guppi

Recommended Posts

Hello I dont know how to read the Error out of the Program ich tried this.

ErrorLog = can.get_error_log()
print(str(ErrorLog))

the answer is this:

ErrorLoG:
ErrorLog(transceiver_state=0, transceiver_write_error_level=0, transceiver_read_error_level=0, transceiver_stuffing_error_count=0, transceiver_format_error_count=0, transceiver_ack_error_count=0, transceiver_bit1_error_count=197, transceiver_bit0_error_count=0, transceiver_crc_error_count=0, write_buffer_timeout_error_count=0, read_buffer_overflow_error_count=0, read_buffer_overflow_error_occurred=(False, False), read_backlog_overflow_error_count=0)
Press key to exit

When i have an Error on the CAN Brick V2 (Red LED is on), i want to reset the Brick or if anyboday has an idear how to solve this?

If i have an erroe i tried this:

HOST = "localhost"
PORT = 4223
UID_can = "can"     # Change XYZ to the UID of your CAN In Bricklet 2.0
from tinkerforge.bricklet_can_v2 import BrickletCANV2
from tinkerforge.ip_connection import IPConnection
ipcon = IPConnection() # Create IP connection
can = BrickletCANV2(UID_can, ipcon)
Reset = can.reset()
HOST = "localhost"
PORT = 4223
UID_can = "can"     # Change XYZ to the UID of your CAN In Bricklet 2.0
from tinkerforge.bricklet_can_v2 import BrickletCANV2
from tinkerforge.ip_connection import IPConnection
ipcon = IPConnection() # Create IP connection
can = BrickletCANV2(UID_can, ipcon)

 

But i get an Error (I deletet my folder ;)):

Traceback (most recent call last):
  File "C:/Users/.../ErrorLogTest.py", line 8, in <module>
    Reset = can.reset()
  File "C:/Users/...\tinkerforge\bricklet_can_v2.py", line 697, in reset
    self.check_validity()
  File "C:/Users/...\tinkerforge\ip_connection.py", line 506, in check_validity
    device_identifier = self.ipcon.send_request(self, 255, (), '', 33, '8s 8s c 3B 3B H')[5] # <device>.get_identity
  File "C:/Users/...\tinkerforge\ip_connection.py", line 1302, in send_request
    self.send(request)
  File "C:/Users/...\tinkerforge\ip_connection.py", line 1274, in send
    raise Error(Error.NOT_CONNECTED, 'Not connected')
tinkerforge.ip_connection.Error: Not connected (-8)

So anybody can help me with this problem?

Link zu diesem Kommentar
Share on other sites

  • 2 months later...

As the "Not connected" error indicates, you didn't connect the IP Connection. Take a look at any of our Python examples. Before the can.reset() call you have to call ipcon.connect(HOST, PORT).

But you should figure out where the bit1 errors are coming from. Double check you electrical CAN bus connection. Did you mix up CAN-low and CAN-high?

Also, your post seem to be from May 28 2021, but you seem to have registered your account on August 23 2021 (yesterday). This is confusing me.

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...