I have tried various Nodemcu builds based on the idf 4 (including the online builder) and cannot get the CAN bus to work on the built-in CAN controller. When I do make menuconfig, I don't see anything about the CAN module except the TWAI configuration. I believe that the module is included in the build by default, but perhaps this is not the case. Thanks for any advice!
local can = require("can") --just for test
can.setup({
speed = 500,
tx = 5,
rx = 4,
dual_filter = false,
code = 0,
mask = 0xffffffff
}, function(format, msg_id, data)
print(format, msg_id, data)
end)
sendTimer = tmr.create()
sendTimer:register(1000, tmr.ALARM_AUTO, function()
can.send(can.STANDARD_FRAME, 0x123, "a");
print('send...')
end)
can.start()
sendTimer:start()
Tryin send and recieve CAN message, but this not working Some of my builds give the message that CAN not not defined (can.lua:2: attempt to index a nil value (field 'can') ), and build from online service (where does kan end up in the list of modules) give the effect:
- transmitted message from another device i see in CAN sniffer, but in my code callback no calling.
- When a try send message every 1000 ms I don't see any activity to the TX pin on ESP32 (measure oscilloscope to)