Ejemplo n.º 1
0
import can_lib_auguste as au
import RPi.GPIO as GPIO

au.startSpi(1)
GPIO.setmode(GPIO.BCM)

GPIO.setup(25, GPIO.OUT)
GPIO.output(25, GPIO.HIGH)

au.getCANCTRL()
au.setBFPCTRL(0x1C)
Ejemplo n.º 2
0
import can_lib_auguste as au
import time

runtime = 60*60         #in seconds
loginterval = 1         #in seconds

stime = 0.05

au.startSpi(500000, 1)
au.softReset()

au.setCANCTRL(0x80) #set configuration mode
au.setCANINTE(0x1F) #enable interrupts on transmit empty and on receive full
au.extendedID()        #enable extended identifier
au.setCANINTF(0x00) #clear all interrupt flags
au.setRXBnCTRL(0x64)    #accept all incomming messages and enable roll over
au.setCNF1(0x0F) # au.setCNF1(0xFF)    #Used to be:0x0F 
au.setCNF2(0x90) # au.setCNF2(0xA8)    #Used to be:0x90
au.setCNF3(0x02) # au.setCNF3(0x05)    #Used to be:0x02

au.setTXBnSIDH(0x00, 0) #set standard identifier 8 high bits
au.setTXBnSIDL(0x08, 0) #set low 3 bits stid and extended identifier
au.setTXBnEID8(0x00, 0)
au.setTXBnEID0(0x04, 0)

au.setTXBnDLC(0x08, 0)  #Transmitted message will be a dataframe with 8 bits
time.sleep(stime)
au.setTXBnDM([3 for x in range(8)], 0)
au.getTXBnDM()
time.sleep(stime)
au.getCANINTF()
Ejemplo n.º 3
0
import can_lib_auguste as au
import time

stime = 0.05

au.startSpi(500000, 0)
au.softReset()

au.setCANCTRL(0x80) #set configuration mode
au.setCANINTE(0x1F) #enable interrupts on transmit empty and on receive full
au.setCANINTF(0x00) #clear all interrupt flags
au.setRXBnCTRL(0x64)    #accept all incomming messages and enable roll over

au.setTXBnSIDH(0xFF, 0) #set standard identifier 8 high bits
au.setTXBnSIDL(0xFF, 0) #set low 3 bits stid and extended identifier
au.setTXBnEID8(0xFF, 0)
au.setTXBnEID0(0xFF, 0)

au.setTXBnDLC(0x08, 0)  #Transmitted message will be a dataframe with 8 bits
time.sleep(stime)
au.setTXBnDM([x*3 for x in range(8)], 0)
time.sleep(stime)

au.setCANCTRL(0x40) #set loopback mode
#
au.setTXBnCTRL(0x0B, 0) #set TXREQ bit high and highest message priority
time.sleep(stime)
#
#
print(au.getRXBnDM())   #print message if received