- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
How do I get my system with two CPU's to use the same RS232 UART as STDOUT? It works fine with only one, but when conneccted with two cpu's I get a "permission denied" message, and the my program(on chip) halts. I'm using a mutex to avoid collisions and I use JTAg for STDIN and debug. Any help? -StianLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In general you can't use the same peripheral from multiple CPUs.
For the specific case of the UART you are probably having interrupt problems. The first CPU puts some characters into the UART and then enables interrupts so it can find out when the buffer has emptied. When the interrupt occurs both CPUs will race to service it - it's random which one gets there first. The CPU which doesn't win the race will see a spurious interrupt and have undefined behaviour. If you select "use small drivers" then you will get the polled (non interrupt-driven) UART driver which won't suffer from these problems - but there will still be races between the CPUs which will occasionally lose characters. The only safe way to do this is to use two UARTs or one UART protected by a mutex, although the latter will still have problems with where received characters go to.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To keep things simple, can you get by with an RS232 Uart and a JTAG Uart? In situations like these I usually give the resource to a single CPU, and if the data was intended for the other CPU then CPU1 passes the data to CPU2 (by whatever means available). Only problem with this is that you have to "tag" your data so that CPU1 knows whether it is for it or the CPU2. If this isn't an option let us know and maybe someone will have a more suitable idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for replies
The UART is used for output only. The idea was to have both cpu's to use the same uart, controlled by a mutex. The output should be shown with hyperteminal running on the host pc. Using two jtag modules shows output data on seprate windows in the IDE, but I want to collect them in one window. Stian
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page