It is fully embedded in MIOS32, this is 4 files to add and some changes in others.
the new dirvers:
mios32_can.c, mios32_can.h for the CAN features
mios32_can_midi.c, mios32_can_midi.h for native MIDI other the CAN
This is my entire trunk. But there’s more than the MCAN feature added… It’s my experiencing thrunk, I test the m16 and the dipCoreF4 with it.
With it you can also test the HID support, with a Disco or wCore and OTG FS as HOST, but it remains me to add the callback installer for app layer.
On the MCAN side:
For testing with hardware you just need 2 or more Cores over the CAN bus, using J18 with ‘MBNET’ one wire.
In software, MCAN driver has to be enabled.
/* the use of CAN Controller must be precised. */ #define MIOS32_USE_CAN /* CAN1 is MCAN must be precised. */ #define MIOS32_USE_CAN_MIDI /* Number MCAN MIDI Ports, default and max is 16 */ #define MIOS32_CAN_MIDI_NUM_PORTS 16
I won’t be able to sort this out the next two weeks due to limited time.
Would it be possible that you create a minimal update branch until then which is easier to review? This would simplify the work at my side.
Once you did this, you could add your local changes again to the official version (they should be taken over separately)
Would it be possible that you create a minimal update branch until then which is easier to review?
I tried but without success, under eclipse I can create a branch but i don’t know where I have to..?
I just ‘succeed’ to copy trunk in trunk and and deleted it.
Do you suggest me to create a copy of the trunk, with another name, in the same root?
branching is a new concept for me but I can try again if someone can help me, explain me a few, a kind of quickstart for branch under SVN.
You then set MIOS32_PATH to branches/my_activity (resp. the name of your branch directory) instead of trunk
Note that this branch looks like a complete copy, but actually it’s only a reference on the server, which we will delete once we are happy with the changes and merging has been done.
Your changes are still documented in the history.
2 cores interconnected with simple ‘One Wire’. But you can add more:
2 wires in fact, we need a short common ground too.
Bus length is limited to a total of 45cm. Unknown maximum number of Cores, but 4 is suggested.
3 interconnected Cores with CAN Tranceivers:
Cables between the MCAN modules are RJ12, I use molded high speed ADSL cables from supermarket.
First RJ12 connector is IO , second is a Loop Thru. If loop is not used each MCAN module has a 120 Ohm terminator switch. First and last nodes must have terminator ON.
Bus length is limited to a total of 15m. Unknown maximum number of Cores, just respect maximum bus length.
For both connection methods, the Cores are dialoguing in MIDI natively , thru the 16 virtuals MCAN ports.
This is something you can expand, you can create your own Sysex based MCAN layer to build one unique app which is in fact a multi-Core App.
Or you can easily create your MIDIBox(es) based Network to interconnect yours Seq, Synth and/or Controllers App. with easy to find ADSL cables.
Note: In basic mode , all nodes(Cores) can talk, if one is talking the others are listening, that’s all. Message priority is based on the types of MIDI events, and there’s no filtering or Node ID to set.
Alright, this is now much better to review, I just need to enter “meld branches/mcan trunk” and get a nice graphical diff + merge function.
Some first observations:
mios32_can.h and mios32_can_midi.h define types which are not in the mios32_* namespace, which could collide with types defined at higher SW layers.
Therefore please add the mios32_ postfix to all types which are visible in these header files
how to you handle collisions?
If two cores send a frame with the same ID concurrently, the arbitration will pass and the remaining frame might collide (e.g. due to different data being sent).
The CAN nodes won’t automatically re-send the frames.
This situation could be avoided if you ensure that each core sends unique IDs, e.g. bring source and destination node into the ID.
I guess that you considered this for extended frames, but this format isn’t enabled by default… you should do this.
mios32_can.h: MIOS32_CAN_VERBOSE should be optional (#ifndef MIOS32_CAN_VERBOSE) and disabled by default
you can change the copyright notice to your name (I’m not the creator of this part, you are!
mios32_can.h and mios32_can_midi.h define types which are not in the mios32_* namespace, which could collide with types defined at higher SW layers.
Therefore please add the mios32_ postfix to all types which are visible in these header files
Of course it’s done.
12 hours ago, TK. said:
how to you handle collisions?
If two cores send a frame with the same ID concurrently, the arbitration will pass and the remaining frame might collide (e.g. due to different data being sent).
The CAN nodes won’t automatically re-send the frames.
This situation could be avoided if you ensure that each core sends unique IDs, e.g. bring source and destination node into the ID.
I guess that you considered this for extended frames, but this format isn’t enabled by default… you should do this.
I don’t manage collisions in basic mode, it was the case before but after some tests I removed it cause it was working fine, for a basic mode. Errors happens only when the traffic begins to be very dense.
On error It doesn’t stop or isolate the node I just loose some frame. It’s a choice for this mode. Very short frames but collision are not handled.
In enhanced Mode the Extended Id is used there’s no problem. But I will do if you think it’s a bad idea to let it like that, for that I’ve got 2 choices:
Using the extended Id for basic mode too.
I can add 3 bits for node signature in the standard id and limit the basic mode to 8 nodes maximum.
how to you handle collisions?
If two cores send a frame with the same ID concurrently, the arbitration will pass and the remaining frame might collide (e.g. due to different data being sent).
The CAN nodes won’t automatically re-send the frames.
This situation could be avoided if you ensure that each core sends unique IDs, e.g. bring source and destination node into the ID.
I guess that you considered this for extended frames, but this format isn’t enabled by default… you should do this.
I don’t manage collisions in basic mode, it was the case before but after some tests I removed it cause it was working fine, for a basic mode. Errors happens only when the traffic begins to be very dense.
On error It doesn’t stop or isolate the node I just loose some frame. It’s a choice for this mode. Very short frames but collision are not handled.
In enhanced Mode the Extended Id is used there’s no problem. But I will do if you think it’s a bad idea to let it like that, for that I’ve got 2 choices:
Using the extended Id for basic mode too.
I can add 3 bits for node signature in the standard id and limit the basic mode to 8 nodes maximum.
I can shift vman_prio field after type and cable and use it for a 3 bits limited Id.
I decided to add a Basic Id field, 3 bits which will allow 8 Cores on the MCAN Bus. And remove the vman_prio field which was an optional feature.
I think it’s the best compromise.
8 chained cores max in the basic mode(basic_id), the basic_node field will not be used in extended mode and replaced by the src_node.
Of course this basic_node id will have to be declared in mios32_config.h and different for each core on the buss, value from 0 to 7.
Notes: the type of message is always a priority, the cable has priority over the id
As you can see, we can either define a block + confirmation value, or individual values + confirm.
If you could predict today how many bytes need to be allocated, we could use a single confirmation which saves space for other future extensions (used for other purposes)
As you can see, we can either define a block + confirmation value, or individual values + confirm.
If you could predict today how many bytes need to be allocated, we could use a single confirmation which saves space for other future extensions (used for other purposes)
Best Regards, Thorsten.
Hi Thorsten,
For the basic mode nothing more than the node number is necessary. It’s 3 bits (0…7) then 1 byte is enough
Something like this:
# define MIOS32\_SYS\_ADDR\_DEVICE\_ID\_CONFIRM (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd0) // 0x42 to confirm value # define MIOS32\_SYS\_ADDR\_DEVICE\_ID (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd1) # define MIOS32\_SYS\_ADDR\_FASTBOOT\_CONFIRM (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd2) // 0x42 to confirm value # define MIOS32\_SYS\_ADDR\_FASTBOOT (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd3) # define MIOS32\_SYS\_ADDR\_SINGLE\_USB\_CONFIRM (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd4) // 0x42 to confirm value # define MIOS32\_SYS\_ADDR\_SINGLE\_USB (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd5) # define MIOS32\_SYS\_ADDR\_ENFORCE\_USB\_DEVICE\_CONFIRM (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd6) // 0x42 to confirm value # define MIOS32\_SYS\_ADDR\_ENFORCE\_USB\_DEVICE (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd7) # define MIOS32\_SYS\_ADDR\_SPI\_MIDI\_CONFIRM (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd8) // 0x42 to confirm value # define MIOS32\_SYS\_ADDR\_SPI\_MIDI (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xd9) # define MIOS32\_SYS\_ADDR\_MCAN\_NODE\_CONFIRM (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xda) // 0x42 to confirm value # define MIOS32\_SYS\_ADDR\_MCAN\_NODE (MIOS32\_SYS\_ADDR\_BSL\_INFO\_BEGIN+0xdb)
Let me 1 day or 2 and I will do the stuff for the Bootloader Updater, as you get the minimum to do, just valid/correct.
Except if you really want to do it yourself.