Is there any published source code for the MIAC Advanced Expansion ?
or at the very least some detailed documentation on the CAN bus messages it accepts and ALL their options ?
I have managed to piece together basic communication between it and the MIAC base unit in C, but there appears to be a bunch of bugs in the UART handling code, or some aspect of it that is just undocumented. plenty of places in the CAL and online documentation that just refer to 'Flags' and never define what any of them are.
MIAC Advanced
-
- Posts: 3
- Joined: Wed May 11, 2016 12:28 pm
- Been thanked: 1 time
- Contact:
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
-
- Posts: 3
- Joined: Wed May 11, 2016 12:28 pm
- Been thanked: 1 time
- Contact:
Re: MIAC Advanced
Yes, that's the documentation i am complaining about.
The total sum of documentation for the UART Init command for example
Code: Select all
416 Init (txsta, spbrg, data size, config flags, rts terminal, cts terminal)
Also, code 420 'Receive String', that one is definitely broken, it can only receive upto 6 characters then silently swallows the rest, I even tried building the same simple routine in flowcode and it did the same thing.
Maybe one of the init flags addresses these issues, but its not documented.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: MIAC Advanced
Here are the parameter details for the UART initialise command:
1) UBRG high byte. Where UBRG value = (750000/baud)-1
2) UBRG low byte.
3) Character bit width (value of 8 or 9)
4) Config Flags:
Bit 0: Flow control (0 = Disabled)
Bit 1: Echo control (0 = Off)
Bit 2: Set this to 1 (needs further investigation)
Bit 3: 0 for 8 bit return, 1 for 16 bit return value
5) RTS Terminal number
6) CTS Terminal number
1) UBRG high byte. Where UBRG value = (750000/baud)-1
2) UBRG low byte.
3) Character bit width (value of 8 or 9)
4) Config Flags:
Bit 0: Flow control (0 = Disabled)
Bit 1: Echo control (0 = Off)
Bit 2: Set this to 1 (needs further investigation)
Bit 3: 0 for 8 bit return, 1 for 16 bit return value
5) RTS Terminal number
6) CTS Terminal number
-
- Posts: 3
- Joined: Wed May 11, 2016 12:28 pm
- Been thanked: 1 time
- Contact:
Re: MIAC Advanced
Ah ha, that matches up much better with what i could see flowcode trying to do with it, and explains the options, thanks.
The option to set 16bit responses also fixes the other issue i was having, as it makes UART_ReceiveChar return 0x200 for no data, instead of 0xFF.
thanks
btw, if anyone else is looking to program their MIAC from Linux (as XC8 and MPLABX work fine there) search for and download a tool called 'fsusb' you just need to tweak the sourcecode to change the vendorID and productID it is looking for, and it works a treat.
The option to set 16bit responses also fixes the other issue i was having, as it makes UART_ReceiveChar return 0x200 for no data, instead of 0xFF.
thanks
btw, if anyone else is looking to program their MIAC from Linux (as XC8 and MPLABX work fine there) search for and download a tool called 'fsusb' you just need to tweak the sourcecode to change the vendorID and productID it is looking for, and it works a treat.