Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino plus uart communication


  • Please log in to reply
8 replies to this topic

#1 lonko

lonko

    New Member

  • Members
  • Pip
  • 3 posts

Posted 08 October 2011 - 04:01 PM

I'm in the process of integrating a coin acceptor that runs on MDB (multi drop bus) which uses 9 bit communication. 8 data bits and 9th mode bit which is used for addressing a device on MDB and for detecting end of transmission from device to master. Now before i start cuppling everything together i need to know if it is possible to use 9data bits with NetDuino. And how to use 9 data bits... how to use send what data type do i pass to send or is then for sending a 9bit data needed 2 bytes or how? Hope somebody knows :P Best regards

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 09 October 2011 - 05:27 AM

The 9th bit is supported by the Netduino, along with the .Net (Micro) Framework. However, there are only five choices:
  • None: No parity check occurs.
  • Odd: Sets the parity bit so that the count of bits set is an odd number.
  • Even: Sets the parity bit so that the count of bits set is an even number.
  • Mark: Leaves the parity bit set to 1.
  • Space: Leaves the parity bit set to 0.
Even on the full Framework there's no way to control the 9th over the above predefined rules.

That should be pretty reasonable, because to achieve the possibility to treat the 9th bit as a normal data bit, it needs an extra buffer of data to store its sequence.
I never heard any UART chip allowing this feature. The most "flexible" way would be to set explicitly the 9th bit by your code, but that's an overkill for performance.

I would recommend a XON/XOFF solution instead.
Cheers
Biggest fault of Netduino? It runs by electricity.

#3 lonko

lonko

    New Member

  • Members
  • Pip
  • 3 posts

Posted 09 October 2011 - 08:32 AM

Can you explain using xon xoff? I have tried mark/space parity on linux but the problem is always with the receive, because parity check for MARK never works at least it did not work for me :S How can this be achieved by xon*xoff? Thank you!!!

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 09 October 2011 - 12:11 PM

XON/XOFF is just an example.
Basically, instead of using the 9th bit to transport an extra-info, you may use a special prefix on your data stream.

Now, I don't know what you are doing, but a very simple example of multidrop protocol is the Modbus RTU.
There is only one master, but one or more slaves: this classification is also stable (i.e. the master cannot be a slave or vice-versa).
The master initiates the transmission toward one slave by issuing a well-known "start-of-message". Any of the slave must begin listening the next byte, because it is the "address". But only one will be actually involved in the communication, being its address matching the message field.
And so away...

Is it that what you are looking for?
Biggest fault of Netduino? It runs by electricity.

#5 lonko

lonko

    New Member

  • Members
  • Pip
  • 3 posts

Posted 20 October 2011 - 08:54 AM

Sorry for the late response did not get the notification that the reply was posted :S i'm trying to implement MDB for vending devices, coin acceptor device. protocol is: http://www.vending.o...B_Version_4.pdf And it statest that master controls slaves and the communication is like this: 8 data bits 1 mode bit = 9 bits to travel. When master is addressing the slave sets mode bit to 1 meaning [ADDRESS + modebit(1) =9bits]+[data for slave+modebit(0)]+... When slave responds the last BYTE sent has modebit set to 1 so that master knows that this is the last byte in the transmission like ETX in the normal uart comm. That is what i'm trying to do on the netduino. I know how to intiate master -> slave with parity mark, space, but the problem is on receive, because i cannot detect the mode bit = 1 on the last byte so that i know that we have end of transmission. Problem is in variable data len in response, where u need the detection of the modebit = 1. Best regards,

#6 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 20 October 2011 - 12:17 PM

Hello Ionko.
This protocol is very odd. I never saw a so strange use of the parity bit.
I guess would be hard to find a workaround, since I'm not sure you would solve this problem even writing your own native C/C++ driver. Most of the time, the parity bit either is hardware calculated, or must be fixed along the whole message.

At this point, I may suggest you to pick up an AVR microcontroller (such as Boarduino, for instance), then implementing the UART in a bitbang-fashion. It'll be not a walk, but it sounds the easiest way to come out.
However, once the Boarduino-based-UART is working, you may connect it to the Netduino via SPI. I have done already some experiment on that, and it works. Note that I do NOT have any bitbanged-UART implementation.
Not sure about, but this library for Arduino could fit.
Cheers
Biggest fault of Netduino? It runs by electricity.

#7 Napalm

Napalm

    New Member

  • Members
  • Pip
  • 5 posts
  • LocationBlack Forrest / Germany

Posted 21 October 2011 - 07:39 AM

I know how to intiate master -> slave with parity mark, space, but the problem is on receive, because i cannot detect the mode bit = 1 on the last byte so that i know that we have end of transmission. Problem is in variable data len in response, where u need the detection of the modebit = 1.


I am working on exactly the same problem. On my pc and on windows CE i solved it by switching the parity from space to mark while sending and ignoring the parity on receiving, but using a intercharacter timeout.

It works on pc and windows ce with CF Net 3.5. Now i am waiting for my netduino to arrive.

If you have any news on that topic, please let me know.

regards
Mirko

#8 jduke

jduke

    New Member

  • Members
  • Pip
  • 1 posts

Posted 23 November 2012 - 02:41 PM

Hi I am a newbie programming the MDB. I have question about the programming of the device. I understand how to set the modebit by using the parity mark and space. my question is if I want to send the a code to the MDB as a cashless device. I want to send a reset code of 60H then the setup code 61H my code would look like the following: Mode Address command Response Reset 1 01100 000 60H no data Setup 1 01101 000 61H 01H Now my first question when I send the Setup command I should see a response code of 01H. My second question in the Multi-Drop Bus /Internal Communication Protocol document section 7 page 126 7.4.2 Setup Config Data it shows the Setup then the Y1-Y5 my question here is the Y bits or a 5 byte data? I am new with this and I could use the help. Thanks JJ

#9 croll12

croll12

    Member

  • Members
  • PipPip
  • 10 posts

Posted 27 July 2014 - 03:20 PM

Sorry to resurrect an old post, but I too am trying the same thing.  Did anyone figure this out?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.