Comments (5)
Hi @r2r0
But if we will try to add another station then we will need to assign addresses explicitly which is not possible with current IFd implementation.
Yes, you're absolutely correct. IFd interface doesn't have support for NRM mode yet. The support of NRM mode is added only to C-style API for now.
If yes, ten would it be possible to add to IFd appropriate update for station address initialization?
Yes, it is possible. It will take some time.
from tinyproto.
Hi @lexus2k ,
Thanks for your answer.
After reading your explanation I realized that the origin of my problem may be not addressing, but mode initialization.
The init structure used in IFd
constructor has default initialization for mode field and this causes mode to be initilized to 0 (TINY_FD_MODE_ABM
).
Do you think that it was good approach to explicitly initialize mode field with TINY_FD_MODE_NRM
?
FYI - the origin of the problem is that I use th newest tinyproto in the device and "old" version (from November) in the host and they are not able to communicate. After recompilation of host application communication was established but content of synchronization frames is different (addresses), so it worried me a little and I started poking around.
from tinyproto.
Hello, again
After reading your explanation I realized that the origin of my problem may be not addressing, but mode initialization.
The init structure used in IFd constructor has default initialization for mode field and this causes mode to be initilized to 0 (TINY_FD_MODE_ABM).
The previous implementation of tinyproto had been using 0xFF as address field for ABM mode. but according to official RFC documents, stations in ABM mode must use 0x01 or 0x03 as address field value (that corresponds to addres 0x00, because 2 lower bits have special meaning).
Of course, if you need I can make dedicated branch for you with old address field value 0xFF.
static uint8_t __address_field_to_peer(tiny_fd_handle_t handle, uint8_t address)
{
// Always clear C/R bit (0x00000010) when comparing addresses
address &= (~HDLC_CR_BIT);
// Exit, if extension bit is not set.
if ( !(address & HDLC_E_BIT) )
{
// We do not support this format for now.
return 0xFF;
}
// If our station is SECONDARY station, then we must check that the frame is for us
if ( __is_secondary_station( handle ) || handle->mode == TINY_FD_MODE_ABM )
{
// Check that the frame is for us
return address == handle->addr ? 0 : 0xFF; // <<<<<<< This check may affect your case, just change to return 0;
}
// This code works only for primary station in NRM mode
for ( uint8_t peer = 0; peer < handle->peers_count; peer++ )
{
if ( handle->peers[peer].addr == address )
{
return peer;
}
}
// Return "NOT found peer"
return 0xFF;
}
Do you think that it was good approach to explicitly initialize mode field with TINY_FD_MODE_NRM?
To advise you something useful, I need to have more details on what you're trying to implement. Originally tinyproto was intended only for peer to peer connections. One to many is the new feature, and it has its own limitations.
from tinyproto.
Ok, it is clear now, thank you very much.
As I wrote origin of this issue was incomaptibility of "old" and "new" implementations, but after cause is now well known it is no longer a big problem for me.
If needed I will manage my own branch with above code.
One to many future is for now only in my plans and depends also on hardware changes, so after I will have better picture of my need I will contact you.
BTW> If IFd
is supposed to handle ABM only, then maybe it will be good idea to explicitely state that and add to IFd::begin
:
init.mode = TINY_FD_MODE_ABM;
from tinyproto.
If IFd is supposed to handle ABM only, then maybe it will be good idea to explicitely state that and add to IFd::begin:
init.mode = TINY_FD_MODE_ABM;
Good idea.
from tinyproto.
Related Issues (20)
- Integrate 1-Wire protocol to tinyproto library
- Software serial support HOT 2
- Pyserial and tinyproto example HOT 10
- proto.run_rx hangs indefinitely in Arduino HOT 1
- Unreliable communication with tinyproto HOT 2
- TinyProtocolStream - encapsulate tinyproto into Arduino Stream for ease of use HOT 2
- License? HOT 2
- Multidrop / Master+Slaves on RS485 or similar HOT 17
- Pi Pico serial1 problem HOT 10
- Questions on connection management HOT 3
- Add support for ESP32 "BluetoothSerial.h"? HOT 1
- Simple build fails on Teensy 4.1 HOT 1
- Build with visual studio works, but unable to do a proto begin --> m_handle=null HOT 3
- Connection is silently re-established
- Connection breaks down if nothing is sent for >= keep alive timeout HOT 2
- Unable to successfully begin() Python Tinyproto when using crc settings different than CRC16 HOT 1
- Unable to connect to tinyproto after second connection. HOT 1
- riscv processor based esp32 series support(and more) HOT 7
- Arduino due doesn't seem to work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinyproto.