gioblu / pjon Goto Github PK
View Code? Open in Web Editor NEWPJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
License: Other
PJON (Padded Jittering Operative Network) is an experimental, arduino-compatible, multi-master, multi-media network protocol.
License: Other
Ciao! Its a week I am reasoning to experiment the addition of a device presence confirmation bit after the receiver device id transmission. So the receiver should set the bus HIGH only if the packet is for its ID, giving confirmation of presence on the bus to the transmitting device. This addition would add a bit of overhead per packet, but would extremely reduce the bandwidth occupation when a device is not receiving and another device is trying to communicate with it. So the bus would not be flooded by an entire packet transmitted multiple times, but by packet headers containing only the id, if you consider the a test case sending of a 50 bytes packet to a device is not receiving, it is an enormous optimization. This would expand the operational envelope in many devices / high bandwidth usage scenarios.
ID 12 LENGTH 4 CONTENT 64 CRC 130
________________ _ ________________ ________________ __________________
|Sync | Byte | |Sync | Byte |Sync | Byte |Sync | Byte |
|___ | __ | |___ | _ |___ | _ |___ | _ _ |
| | | | | | | | | | | | | | | | | | | | | | | |
| 1 |0|0000|11|00| | 1 |0|00000|1|00| 1 |0|0|1|000000| 1 |0|0|1|0000|1|0|
|___|_|____|__|__|_|___|_|_____|_|__|___|_|_|_|______|___|_|_|_|____|_|_|
|
|
DEVICE PRESENCE CONFIRMATION BIT
Feel free to give your feedback and considerations about it.
hi there, i cant get a network up and running with two uno's and one mega2560, if i use a third uno PJON works like a charm.
Maybe i found the right excuse to buy a new oscilloscope!
Can you create a new branch for a new library version?
--> https://github.com/PaoloP74/PJON/tree/PJON-1.5.x
Currently there are timing definitions for the STANDARD
mode only.
Hi, can we move the subj to be on the same level as all other header files? E.g. it makes things work out of the box when not using an arduino ide, otherwise have to go in and modify the paths manually.
I see that the source code has plenty of comments, but a specification be much more readable in a separate Markdown file or (GitHub) wiki page.
(continued from https://news.ycombinator.com/item?id=10283322)
Hi,
Sorry if an issue isn't the best way to ask this, but I couldn't find any other way. Could you please specify a licence. I would really love to use this in my garage-scale (hopefully) commercial product.
I see that it uses Wiring, but I'd be interested what the minimum requirements are for a compatible implementation. For example, would it be possible to implement it without some serious bit hacking on an ATtiny?
(continued from https://news.ycombinator.com/item?id=10283322)
Since I want to use PJON for a stepper motor project, I need to use interrups. The interrups make sure the motor runs, while the main runloop is free for other tasks (like receiving any network communication).
Unfortunately, PJON is unable to receive any messages, while the interrupts are active. If I disable the interrups, everything works fine.
Any idea how to solve this?
I'm using https://github.com/PaulStoffregen/TimerOne to configure the interrups, and run the interrupts on a 50 microsecond interval.
I'm trying to get this working with an ATTiny85 and having problems with the Arduino IDE. I installed the ATTiny package for the Arduino IDE, but get these compiler errors:
Build options changed, rebuilding all In file included from C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.h:33:0, ``` from C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:23: ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'boolean PJON::can_start()': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:28: error: 'DDRD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:82:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, INPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:71: error: 'DDRC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:82:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, INPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'void PJON::send_bit(uint8_t, int)': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:96:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, VALUE); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:96:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, VALUE); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'void PJON::send_byte(uint8_t)': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:118:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, HIGH); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:118:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, HIGH); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:120:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, LOW); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:120:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, LOW); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'int PJON::send_string(uint8_t, char*, uint8_t)': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:28: error: 'DDRD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:149:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, OUTPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:71: error: 'DDRC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:149:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, OUTPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:162:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, LOW); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:162:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, LOW); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'uint8_t PJON::syncronization_bit()': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:94:28: error: 'PIND' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:9:33: note: in definition of macro 'BIT_READ' #define BIT_READ(value, bit) (((value) >> (bit)) & 0x01) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:162:14: note: in expansion of macro 'digitalPinToPINReg' ( BIT_READ(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:159:37: note: in expansion of macro '_digitalReadFast_' #define digitalReadFast(P) ( (int) _digitalReadFast_((P)) ) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:270:23: note: in expansion of macro 'digitalReadFast' uint8_t bit_value = digitalReadFast(_input_pin); ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:94:71: error: 'PINC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:9:33: note: in definition of macro 'BIT_READ' #define BIT_READ(value, bit) (((value) >> (bit)) & 0x01) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:162:14: note: in expansion of macro 'digitalPinToPINReg' ( BIT_READ(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:159:37: note: in expansion of macro '_digitalReadFast_' #define digitalReadFast(P) ( (int) _digitalReadFast_((P)) ) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:270:23: note: in expansion of macro 'digitalReadFast' uint8_t bit_value = digitalReadFast(_input_pin); ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'int PJON::receive_byte()': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:28: error: 'DDRD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:292:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, INPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:71: error: 'DDRC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:292:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, INPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:293:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, LOW); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:293:3: note: in expansion of macro 'digitalWriteFast' digitalWriteFast(_input_pin, LOW); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:94:28: error: 'PIND' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:9:33: note: in definition of macro 'BIT_READ' #define BIT_READ(value, bit) (((value) >> (bit)) & 0x01) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:162:14: note: in expansion of macro 'digitalPinToPINReg' ( BIT_READ(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:159:37: note: in expansion of macro '_digitalReadFast_' #define digitalReadFast(P) ( (int) _digitalReadFast_((P)) ) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:295:10: note: in expansion of macro 'digitalReadFast' while (digitalReadFast(_input_pin) && micros() - time <= BIT_SPACER); ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:94:71: error: 'PINC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:9:33: note: in definition of macro 'BIT_READ' #define BIT_READ(value, bit) (((value) >> (bit)) & 0x01) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:162:14: note: in expansion of macro 'digitalPinToPINReg' ( BIT_READ(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:159:37: note: in expansion of macro '_digitalReadFast_' #define digitalReadFast(P) ( (int) _digitalReadFast_((P)) ) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:295:10: note: in expansion of macro 'digitalReadFast' while (digitalReadFast(_input_pin) && micros() - time <= BIT_SPACER); ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'uint8_t PJON::read_byte()': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:94:28: error: 'PIND' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:9:33: note: in definition of macro 'BIT_READ' #define BIT_READ(value, bit) (((value) >> (bit)) & 0x01) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:162:14: note: in expansion of macro 'digitalPinToPINReg' ( BIT_READ(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:159:37: note: in expansion of macro '_digitalReadFast_' #define digitalReadFast(P) ( (int) _digitalReadFast_((P)) ) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:311:19: note: in expansion of macro 'digitalReadFast' ``` byte_value += digitalReadFast(_input_pin) << i; ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:94:71: error: 'PINC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:9:33: note: in definition of macro 'BIT_READ' #define BIT_READ(value, bit) (((value) >> (bit)) & 0x01) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:162:14: note: in expansion of macro 'digitalPinToPINReg' ( BIT_READ(*digitalPinToPINReg(P), __digitalPinToBit(P))) ) : \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:159:37: note: in expansion of macro '_digitalReadFast_' #define digitalReadFast(P) ( (int) _digitalReadFast_((P)) ) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:311:19: note: in expansion of macro 'digitalReadFast' ``` byte_value += digitalReadFast(_input_pin) << i; ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp: In member function 'int PJON::receive()': C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:28: error: 'DDRD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:340:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, OUTPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:92:71: error: 'DDRC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:144:88: note: in expansion of macro 'digitalPinToDDRReg' do {if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToDDRReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:340:3: note: in expansion of macro 'pinModeFast' pinModeFast(_input_pin, OUTPUT); ^ C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:345:7: note: in expansion of macro 'digitalWriteFast' ``` digitalWriteFast(_input_pin, LOW); ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:345:7: note: in expansion of macro 'digitalWriteFast' ``` digitalWriteFast(_input_pin, LOW); ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:28: error: 'PORTD' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:351:7: note: in expansion of macro 'digitalWriteFast' ``` digitalWriteFast(_input_pin, LOW); ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:90:73: error: 'PORTC' was not declared in this scope (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC)) ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:125:12: note: in definition of macro '**atomicWrite**' if ( (int)(A) < 0x40) { bitWrite(*(A), __digitalPinToBit(P), (V) );} \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\includes/digitalWriteFast.h:137:86: note: in expansion of macro 'digitalPinToPortReg' if (**builtin_constant_p(P) && __builtin_constant_p(V)) __atomicWrite**((uint8_t*) digitalPinToPortReg(P),P,V) \ ``` ^ ``` C:\Users\Jordan\Documents\Arduino\libraries\PJON\PJON.cpp:351:7: note: in expansion of macro 'digitalWriteFast' ``` digitalWriteFast(_input_pin, LOW); ^ ``` exit status 1 Error compiling.
The ARP implementation sometimes finds duplicate addresses.
Tested with 5 slave Arduinos (Pro Mini) reporting their address to a master.
I rolled my own ARP for a project – the way I implement it is having all slaves send their randomly generated address to a master, along with a UID (randomly generated 32-bit integer). The master just looks for duplicate addresses if any, and sends a new address to the duplicate devices along with the UID. The slave with the corresponding UID will be set to the new address. This works because the slaves have to talk to a master device which handles the addresses. Having a robust ARP independent of a master device with PJON is perhaps non trivial to do.
Using PJON 3.0 beta as of 2016-05-13.
To me it seems that sending messages in both directions like this works over a wire but not wirelessly.
Having set up two Arduino Unos with a wireless sender+receiver each, I have changed some of the examples from using SoftwareBitBang to OverSampling, and changing set_pin(12) to set_pins(6,7). The SpeedTest and NetworkAnalysis samples work perfectly over the wireless connection.
But I need something similar to the SendAndReceive example, and this will not work with OverSampling and the wireless connection. With the original example and a wire between pin 12 on each Arduino, it works.
The fact that SpeedTest and NetworkAnalysis works fine indicates that my hardware setup is fine. I can also switch which board is Device1.ino and Device2.ino and this also works perfectly.
I have attached the modified example files. The receiver is connected to pin 6 and the transmitter to pin 7 on each of the two Arduinos.
Is the Stipulation about advertising materials compliant with common Open Source license requirements?
Or is this not meant to be strictly speaking Open Source software?
The section I could see being violated is "1. Free Redistribution" because requiring the ad-note could be interpreted as payment of sort.
I don't feel comfortable to say that this is certainly a problem, and I would be glad if a person more competent in these matters could weigh in here.
In any case, your protocol is fantastic 👍 and I'm glad someone has liberated the space of one-wire-ish protocols. I also felt uncomfortable using the dallas one-wire stuff...
Also mad props for the nice and clear writeup of the protocol in the wiki! Well done, sir! 🎉
Currently, the CRC doesn't take the position of a byte into account. This can lead to problems when bytes are missing (e.g. when a device starts to read the stream at an unknown time and misses the first few bytes). I used my little app to test messages with 5 bytes of content (8 bytes in total). With the current CRC calculation method there are a lot of potential issues (and I mean A LOT if one uses more than one device).
Example: The message 3-8-2-6-4-15-13-9 could be received by a device with the id 6 as 6-4-15-13. The CRC is correct, the device sends a faulty ACK, and the device 3 gets a wrong message because two bytes are sent over the channel at the same time.
The CRC calculation needs to be very simple, I guess. Any ideas?
Hi, I spent some time debugging the physical comms on the wire, and saw that current PJON version uses LSB-first mode. This is quite inconvenient when looking at signals and trying to make sense of them. Was it done for some performance reasons? If not, does it make sense to add the MSB/LSB option and leave LSB the default?
¿utilizable con link RF?
I can use it with a single RF module or only cable?
You can comment more about of medium of transportation?
Slight COMPATIBILITY_MODE = false timing slow down for duemilanove / uno / nano to match Arduino Mega execution time and Attiny consequent tuning.
While the documentation clearly describes on how to send short commands, it isn't completely clear how to send arbitrary values. For example, if we want to expand the blink example, by adding the blink speed to the message, how should this be done?
It would be great if a short command could contain an addition payload which would be used as a paramater to the reaction method.
For example:
Sender:
void loop() {
int blink_send = network.send_short_command(100, 'B', '200');
delay(1000);
}
Receiver:
void setup() {
network.insert_reaction('B', led_blink);
};
void led_blink(char *payload) {
int speed = atoi( payload ); //char * to int conversion
digitalWrite(13, HIGH);
delay(speed);
digitalWrite(13, LOW);
};
void loop() {
network.receive(1000);
};
Or is there currently a better way to do this?
Ciao! I am considering to move timing values in a new file Timing.h
to have a dedicated space for that and to mantain clarity and add practical space for useful comments. Let me know what you think about it.
Hi! I have a lot of issues right now. My head is a bit spinning as I was working on this the whole day. Maybe I miss something important. Anyway, I thought I should ask you before I continue with debugging. Hope you can help me.
My setup consists of two Unos and one Nano. When I start my software (a small C# tool) it connects to one of the two Unos ("master", e.g. device id 1) via USB. Then, the Uno sends a "ping" message to the devices 2, 3, 4, 5, and 6 (= "slaves"). The two other devices should then respond with a "I'm alive" message while the non-existing devices 4, 5, and 6 should raise a CONNECTION_LOST error. This usually works perfectly fine but not always.
In a few cases the Nano seems to respond, but the master device doesn't care (receiver function is not called). I started to debug this case. The Nano definitely gets an ACK and removes the package from the queue. I'm not sure if the ACK was sent by the master device or by something else, though.
When I fiddled around to find the cause, "device 4" suddenly stopped raising a CONNECTION_LOST error. I found out that my second Uno was responding to the ping message with ACK although its device id is 3. I removed the Nano to simplify the whole system and added more Serial.print() stuff in your code to see what is being sent and what is being received.
Master sends (this->send_byte is called with these values):
3-4-3-4 // ping for device 3
4-4-3-3 // ping for device 4
Slave receives (this->receive_byte() returns these values):
3-3-0-0 // incorrect!
3-4-0-0 // incorrect!
3-4-0-0 // incorrect!
3-4-3-4 // correct!
This is what happens with the original PJON.cpp. As I said in my last issue, I need to include the sender id. Therefore, I have changed a few parts of your code so the sender id is always included as the first byte of the content. In this case, the messages look like this:
Master sends (this->send_byte is called with these values):
3-5-1-3-4 // ping for device 3
4-5-1-3-3 // ping for device 4
Slave receives (this->receive_byte() returns these values):
3-5-1-3-4 // correct!
3-3-0-0-4 // incorrect!
I have no idea what's happening. Maybe I changed something, I shouldn't have changed, something is interfering, the timings are incorrect, or something is being converted wrongly. I hope my explanations are clear. If you need more information feel free to ask. Any help is appreciated!
I have been able to make this library work (well, the Blink Transmit/Receive examples) on the ATtiny841 (core from https://github.com/SpenceKonde/arduino-tiny-841) by adding AVR_ATtiny841 to the list of Tiny chips.
DigitalWriteFast.h needs some updates as well, but they are over my head (I just reverted back to DigitalWrite in setup to get Blink to work).
It looks like adding 1634 support should be pretty similar. I don't have one of those soldered up yet to test on but it did compile.
I have both chips and can do whatever further testing is needed.
On a happy note, this library is pretty exciting! I have been trying to get OneWire to work between an ESP-03 and a Tiny841 for a while now, and this worked the first try. Good stuff!
Thanks!
Frist of: awesome work. Very impressed with the concept and final product. I'm temped to use it in my current project: 4 automatic curtains controlled by one master Arduino or ESP8266.
Before I do, I would like to know the benefits over using i2c. Is this something you can elaborate on? (Maybe even put it in the Readme doc?)
Thanks for your work. Cheers!
Some IDS are used internally to identify particular types of packets like Broadcast.
In Initialize should be checked if user configured the device using one of theese reserved ids.
Hi gioblu,
very nice library! I have a question, though. Is there a possibility to get the sender id of a package? I saw that the set_receiver function's comment had a param for this in an older version. I guess this has never been implemented, has it? Should I send the sender id as part of the content?
Best,
Fabian
Since PJON is now compatible with the ESP8266 (which is a 3v3 device), it might be helpful to supply a wiring diagram in the readme on how to connect a 3v3 device (ESP8266) to an 5v device (Arduino).
Keep up the good work!
It would be terrific if this library could run on Due and Zero boards.
Thanks
I'm trying to send a byte value as a payload. Any value works, except 0. A zero won't be broadcasted (checked it with a scope.)
Works:
network.send(1, 1, 1);
network.send(1, 2, 1);
network.send(1, 3, 1);
...
network.send(1, 255, 1);
Doesn't work:
network.send(1, 0, 1);
Hi guys,
I've been busy hacking recently (well, scratching my own itch), and brought a custom protocol analyzer for Saleae Logic to a usable state: https://github.com/aperepel/saleae-pjon-protocol-analyzer
It doesn't yet understand multi-byte payloads (will come next, so for now don't send more than a 1 byte payload :) ). It can do a lot already, and I figured I'd put it in front of people sooner rather than later:
https://github.com/aperepel/saleae-pjon-protocol-analyzer/releases
Happy hacking!
I'm sorry for the long delay in my response. I hadn't had the time to test everything until this week. Fortunately, after a lot of testing, I can say it is very stable now when sending short messages. I haven't noticed any more problems so far. I added two more bytes to my messages (a total of 4 bytes now) to be more stable in general, though.
After the problems with small packets, however, I have now problems with big packets (e.g. 50 bytes or more) :-) The problem is not the message's size itself, though. There must be another bug in the receive function. The problem might be that the CRC could be correct although the message isn't.
1.) When PACKET_MAX_LENGTH (e.g. = 50) was lower than the actual size of the received package (e.g. = 60), the first strange thing happened. The sender tried to send the message over and over again but failed with 256 (FAIL). The receiver, however, received the message and instead of declining it, this->_receiver() was called with the data of the last correct message (e.g. the last short message). Long story short, with every FAIL at the sender, I got the same old message at the receiver.
2.) I have to send about 30 packets with a size of about 250 bytes each. As this didn't work very well, I added an id to the messages to see if the order was correct and if all packets were received correctly. I was very surprised when I checked the ids in my receiver function:
0, 0, 1, 2, 3, 4, 5, 5, 8, 9, 10, ...
So, in some cases I recevied the same package twice (while the sender failed with 256). In other cases, I didn't receive the package at all (while the sender reported ACK). It was definitely better after I changed if(!CRC) {
to if(!CRC && (package_length > 4)) {
in your library to ensure that the package might be correct.
My assumption is that there are cases where the loop breaks after one or two bytes (because package_length is 1 or 2 or something) but the CRC is still correct. Then it calls this->_receiver()
with old data (data is never set back to null, is it?) and sends ACK. If the sender is still sending then it doesn't notice the ACK, fails with 256 and resends the package. Could this be the cause? Any ideas how to fix that? I have no idea why some messages are skipped, though. Could be the same reason: ACK when there shouldn't be an ACK.
I have no problem with the fact that big packets might cause a lot of trouble (several FAILs before ACK, interference, etc.) but the fact that the library seems to behave unexpected is the main problem in this case. It works if I send the data splitted into very small packets but that makes it slower. Any idea?
Thanks!
P.S.: As promised I will also reply to your e-mail in the next few days.
Why claim you have encryption when you don't? Also, crypto should not be done at this layer in the first place.
I tried putting together a sketch that both transmits and receives; and it doesn't seem to work.
PJON pjonNet(PjonPin, PjonUnitId);
void OnReceive(uint8_t size, uint8_t* payload) {
// left out code as all it did was echo it to serial
}
void setup() {
pjonNet.set_receiver(OnReceive);
}
void loop() {
pjonNet.update();
pjonNet.receive();
// left out code that all it did was buffer serial input if there was any call pjonNet.send_string() when last char was a '\r'
}
I confirmed the wiring works with your example, but I could not find an example that could be both a sender and receiver.
my installation it is very extensive. I'm about to try using PJON as protocol, but using rs485 like interface.
Analyzing the code I see very optimal to send commands as I need.
I'm trying to control remotely access a door, which sent a command it must receive a state when someone accesses through a RDIF tag.
I have some questions:
The master (data collector) should send commands long variables.
Example: open, 1 character
Add a tag, 10 characters
As came out from tests made by Mauro and from suggestions made by the community on the hackaday post, there is a bug. If we code in the same way many devices and they start at the same time, for example, because of a common power supply, they will likely all collide and in the same way execute quadratic backoff always colliding or finding the channel BUSY
.
So I see 2 possible cases (both leads to collision loop):
On transmitter side:
NAK
(to avoid casual collision)FAIL
(to avoid casual collision)Please feel free to share your point / suggest
Ciao! I am considering which is the best and most efficient approach to implement the PJON standard on Raspberry. Do you have some suggestion? I sincerely would remain on C / C++ / Wiring.
Hi there. Is long time I am considering to give the chance to the user to develop its own strategy for data transmission and reception, and so enable to switch the low level functions needed to physically receive and transmit data. This would give the chance to the user to port different communication media like Infrared / visible light, radio waves (see PJON_ASK) and obviously one or more conductive elements.
I personally developed 3 strategies in my experimentations:
Would be amazing to have the chance to select on instantiation which strategy is more effective with the communication medium used.
Obviously:
In order to free some memory, I see that reducing MAX_PACKETS and PACKET_MAX_LENGTH helps a lot.
Do their value depend on the length of the packets I send? I'm for example never sending packets larger than two bytes.
What should I consider if I want to reduce those values?
Thanks.
Test and if necessary add compatibility to Digitspark ATtiny85 usb board.
Hi,
is there a easy function to send and receive a integer value (8,16 or 32 bit). I think, this is the most payload. And its easier to handle than a string of chars.
And in combination with the sender_id as a content_id it would be more awesome. So i can send one command to all devices.
Ciao! I am a while thinking about this. Would be amazing to ble able to code any device on a PJON bus, through PJON and the bus itself using a dedicated bootloader. Obviously I would start with Arduino Duemilanove.
I didn't see any obvious answer, but what is the expected latency of this protocol and maximum latency? Going just from the speed of compatibility mode, I get 1.8ms to send a byte.. but I'm pretty sure that's not the right way to figure out latency, especially maximum latency with error correction and such
Hi, I was getting frustrated not able to make basics work, but was finally able to dig up that bit in a troubleshooting guide about a 'Busy' signal and, after adding a 10K pull-down resistor, everything worked. I, however, see couple problems with a pull-down resistor requirement:
We could e.g. have an overloaded constructor taking an optional pullup flag (defaulting to false).
Ciao guys. I finally added the PJON's logo in the main readme.
What do you think about it? You like it?
I understand that just connect 1 Data Cable works, but is there you got previous care, pullup resistors, diodes protection?
No it is not clear how protect in a noisy environment or outdoor use.
Can add this to wiki?
I completely understand your desire to implement this entirely in software. This is more of a theory question. I have not tried to implement it yet as I've not got pjon working on ESP8266 just yet! but here goes..
The ESP8266 wifi has to be serviced every so often, otherwise you get a crash. polling a pin for 1ms constantly is not the 'most' efficient thing to do, and would hold up wifi. Is there any reason why I can't put the
network.receive(1000);
receive function inside a call back, and say set the timeout to 1? Would this in theory still work?
This lib looks wicked! and works very well on arduino so thumbs up.
cheers
A
Hi there :)
Been trying to compile this library on a STMF103RB, ARM Cortex-M3 MCU,
http://www2.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103rb.html
similar to the teensy, due. Better known on the http://www.stm32duino.com/ site as the "blue pill"
unfortunately it doesn't compile. It does compile on the ESP8266 12F that I am trying to get to talk to each other.
it complains
'BIT_WIDTH' , 'READ_DELAY', 'BIT_SPACER' 'ACCEPTANCE', "was not declared in this scope"<
i'm guessing that it needs an entry in the timing.h so how to work out those values?
One more thought:
Packet length is fixed at uint8_t , and sending binary data seems to be pretty difficult.
I can understand breaking up a frame of data into 256 byte so as not tie up the bus. Since the datalength has to be stipulated with the data, are there any thoughts to increase the data length size, and/or something to break up large Frames of data into smaller packets with re-assembly?
Raj
Like /u/kloptopsmentions on Reddit, it might be a good idea to implement multicasting.
Maybe sending to ID 0 or 254 would broadcast the message to all devices? You could use this for auto discovery of devices (like ZeroConf). Maybe even allow a way of auto assigning of ID's.
Ciao! I am still testing 3.0-beta but already considering which modifications are necessary to have a nominal functionality with a strategy using an interrupt driven procedure. The first thing came out speaking with a friend is the necessity of the SENDING
state for the packets where interrupt calls are already attached. Feel free to share you consideration.
Two Arduino pro mini ATmega328.
A master set at address 45 and a slave set at 44.
Bus on pin 12.
While sending to device 124 even though it didn't exist on the network, I get ACK values back.
Can someone reproduce this?
Here, I wrote a script to check for a response on all addresses.
Code for master:
#include <PJON.h>
PJON network(12, 45);
char content[] = "ajtyenflhiehfnvk";
void setup() {
Serial.begin(115200);
delay(250);
uint8_t test = 0;
long scan_time;
for (int i=0; i<256; i++) {
scan_time = millis();
while (millis() - scan_time < 20) {
int response = network.send_string(i, content, 16);
if (response == ACK) {
test++;
}
}
if (test > 0) Serial.println(i);
test = 0;
}
}
void loop() {};
Code for slave:
#include <PJON.h>
PJON network(12, 44);
void setup() {
Serial.begin(115200);
};
void loop() {
network.receive();
};
I've been struggling with this for a whole day, and I'm not sure what to do.
Logic is working. See osillyscope, correct signals, correct voltages. I've got 2 arduino nano's communicating. One using BROADCAST, the other receiving. Using STANDARD mode. ESP8266 is 80Mhz. If I write a sketch that attaches an interrupt it detects the pulses.. and seems like the correct timing... but I have no debug info in PJON to work out why it is not detecting the pulses. I get nothing in a the message callback, and no errors either.
Any help appreciated. It looks like the initial low pulse might be a bit long from the arudino... 400us. but I'm really not sure.
What you are implementing is a simple parity scheme. Please don't call it a CRC. In any case, there is plenty of spare cycles to implement CRC8 if all you want to use is eight bits.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.