cancel
Showing results for 
Search instead for 
Did you mean: 

problem with USART multi-processor mode

xinjin
Associate II
Posted on March 06, 2013 at 08:33

Dear,

    I met the problem when use the USART multiprocessor mode. In my USART communication application, even for one USART, there are 3 different addressses for different data packages. But STM32F4 only provide one address to be compared. If I don't use the multiprocessor mode, I cannot identify the data or address on the bus. The basic requirement for me is to identify the data or address on the bus and if the addresses are not for this node, it will ignore or mute. The addresses for one node not only fixed one. So how can I implement?  It works different with ARM7.

B.R.

Jin

#9-bit #multiprocessor
15 REPLIES 15
Posted on March 06, 2013 at 15:41

Couldn't you just use the USART in 9-bit and use a simple state machine in the IRQ handler?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
emalund
Associate III
Posted on March 06, 2013 at 16:11

thet's what we did in the olden days before the '51 had the ''match register'' added

Erik
xinjin
Associate II
Posted on March 06, 2013 at 16:17

I have considered the 9-bits mode and got the data and address from DR register. In 9-bits mode, both data and address would generate the interrupt, I can identify the data and address by software, but I am afraid of the workload in this situation. There are many data when communication starts. I am not clearly understand what you mean about the simple state machine? So could you please give a more detail descripiton. Or may it can save or optimize my application?

Appreciate.

B.R.

Jin

Posted on March 06, 2013 at 17:53

Yes you'll get interrupts, but the stream can be managed very quickly/efficiently. Under 100 cycles at 168 MHz, I'd guess. You don't mention a baud rate. I could use DMA to decimate interrupt load.

http://blog.markshead.com/869/state-machines-computer-science/

At a most simplistic level, 4 states for processing data streams to 3 addresses. State changes when an address is received.

WAIT_FOR_NEXT_ADDRESS (ignoring data)

ACCEPTING_DATA_FOR_ADDRESS_A (seen address A last)

ACCEPTING_DATA_FOR_ADDRESS_B

ACCEPTING_DATA_FOR_ADDRESS_C

I could code it, but not looking to do your job.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
emalund
Associate III
Posted on March 06, 2013 at 23:46

I don't have a f4 or a f4 manual here, but tend to recall a bit ''interrupt only if 9th bit is set''

xinjin
Associate II
Posted on March 07, 2013 at 04:01

The baud rate is 500kHz. I am not worried about the node with address matching. As you suggested, DMA can take the task of data collection. What I am concern is the workload of node without address matching. It is always listening and been interrupted, even when data comes.

Andrew Neil
Evangelist
Posted on March 07, 2013 at 09:07

''I don't have a f4 or a f4 manual here, but tend to recall a bit 'interrupt only if 9th bit is set'.''

That's certainly the way the 8051 worked!

''It is always listening and been interrupted, even when data comes.''

As Erik says, is there not an option to interrupt only on Address bytes (ie, bytes with the 9th bit set)?

Even if there isn't, surely it's only a couple of instructions to test the 9th bit & ignore...?

xinjin
Associate II
Posted on March 07, 2013 at 10:05

As Erik says, is there not an option to interrupt only on Address bytes (ie, bytes with the 9th bit set)?

 

Yes, there is interrupt only on address bytes, but it only support one address. I have 3 different address even for one node.

Even if there isn't, surely it's only a couple of instructions to test the 9th bit & ignore...?

 

My application depends on the communication between the host and slave. Though there is little instructions to test 9th bit and ignore, other tasks with time strict event would be affect. That's why I am worried. But if there is not any other good choice, I have to test it, or change to other MCU.

Andrew Neil
Evangelist
Posted on March 07, 2013 at 18:49

''Yes, there is interrupt only on address bytes, but it only support one address''

You're missing the point!

We're talking about an option that looks only  at the 9th

bit

- without considering the address value.

ie, it just considers whether the bye

is

an addres - without any attention to what address it is.

''I have 3 different address even for one node''

That is not the way that this multiprocessor mode is usually used!

''change to other MCU''

As noted above, I think most MCUs which support this 9-bit mode do only support automatic recognition of a single address per node?

Maybe you could use a part with multiple UARTs, and have each UART configured for a different address...?