I'm trying to use Node Red to configure a video processor (ADV8005) that has 16bit registers addressing.
Unfortunately the node-red-contrib-i2c supports only 8 bit addressing.
Is there another node that could be used?
I need to configure register 0xE400.
Could it work if I use an addtional byte as payload? "command" will be the MSB and the first byte of the payload will be the LSB.
do you use i2c on raspberry pi ?
This isn´t a standard i2c format:
i2c-adddress, address-H, address-L,data-1,data-n>
Yes, on Raspberry. My experience is with 8bit register addressing but I read that 16bit is used too. I don't know very well the low level electric timings but I think that using the first bite of data as Address-L, it should work. What do you think?
writing is easy, you can send all data.
But for receive, you can send only one address byte with node.
One option is use i2cget and i2cset command as command. You can call it from node-red as spawn.
I think, that this commands send/receive multibyte.
You must install this first.
An other option is to write a new node for that.
But this is not so easy.
Or help extend/fix the existing one...
I look at GitHub - fivdi/i2c-bus: I2C serial bus access with Node.js and notice that all commands are byte. If you accept, that payload is an array, then I can write a node for that. Buffer handling in C++ is possible but not easy.
Great! I need only to write registers, today I'm testing if the solution with Address-L in the first byte of payload works. If yes, I'm ok. If not I'll ask for your support! Many many thanks.
Hi dceejay, about the i2c library, what does it means: "This payload can be a Buffer, Array, String or Integer. When you use integers the number of bytes to send is important and can be set between 0 and 31 bytes".
Using Integers, how can I send multiple bytes?
I'm doing this:
msg.command=RegH; msg.payload = (RegL+","+Value); return msg;
RegH is the MSB of the register Addressing,
RegL is the LSB
Value is the value I want to write in the register.
I set 2 in "Send bytes".
Is it fine?
I have a lot of issue... The first is that on the i2c bus, the IC doesn't answer to the scan.
The chip is working because on the board there is an FPGA that configure it and in this condition, it works. Disconnecting the FPGA and driving it with RB Pi3+, the IC doesn't work.
The pull-ups still in the circuit.
The phisical address of the iC is 0x18. I suppose I must receive 24 because I understood that the library works with decimal values.
The electrical waveform, captured with an oscilloscope, seems correct but at the last clock, the slave doesn't ack.
Don't forget to enable i2c on Raspberry PI.
Install i2c tools:
sudo apt-get install i2c-tools
Look for device on i2c bus:
i2cdetect -y 1
i2cget -y 1 0x18
msg.payload = Buffer.from([0x00, 0x01]); // 0x00 is 1st byte, 0x01 is 2nd byte
msg.payload = [0x00, 0x01]]; // 0x00 is 1st number, 0x01 is 2nd number
an String ...
msg.payload = "0x00,0x01";
msg.payload = "0,1";
msg.payload = 1; ← 1 in bytes is [0,1] (big endian)
msg.payload = 256; ← 256 in bytes is [1,0] (little endian)
Hi iiot2k, i2c was enabled.
i2ctools discover the devices. but the i2c scan node can't do it.
On the bus I have 0x18 and 0x1A ( or 0C and 0D with 7 bit standard as shown from i2cdetect).
In any case, even if the scan node doesn't detect any device, the write node with MSB for the command and LSB in the first byte of the payload works fine!
I used the scan node in another application without problems, could there be a bug?
Many thanks to everyone and to this forum for another great support!
Many thanks! Clear.
My doubt was about the string format and the base of the values. I tryed with decimals because in the command box I can write only decimal values (1...255). It works. Does it works with hex values too? How to write hex values in command box?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.