What is the clock of each PIC you use?
Ioannis
I guess then, the sending device is interrupted by the USB routines while sending and as a consequence the transmission of RS-232 at that time is corrupted.
Ioannis
If you're using interrupts on either end then you shouldn't use SEROUT/SERIN as interrupts will upset the timing.
You should use the hardware HSEROUT/HSERIN routines, but then you will have to use the dedicated UART IO pins.
Also, you would be better off running the receiving end with a faster osc setting... try 32MHz instead of 16.
that can't be right becauseI guess then, the sending device is interrupted by the USB routines while sending and as a consequence the transmission of RS-232 at that time is corrupted.
my next guess is that device A is running on 3VoltsI know device A is sending the right data because I can see it with a logical analyzer.
this guessing game has got longer legs than i expected
Warning I'm not a teacher
I think it can be right since Serout/Serout2 happens in a async rate. USB is fast but in any case the soft Serial is interrupted randomly.
The logic analyzer catches one instant of this.
Lowering the baud rate helped because of that interrupt thing. Lower baud has more time on every bit and the fast USB gets away.
I have long that I abandoned software serial port use because of such matters.
Ioannis
Last edited by Ioannis; - 29th April 2024 at 19:50.
The PIC ports with HSEROUT and HSERIN are already taken. Using a baud rate of 9600 instead of 19200 made a difference. It is now working fine. The USB Darrel's interrupt takes micro seconds to execute. I measured it once. I forgot the exact number, but it was very small. That shouldn't affect the SEROUT/SERIN.
"No one is completely worthless. They can always serve as a bad example."
Anonymous
From an old DT post (https://www.picbasic.co.uk/forum/sho...roblem?p=90526)
Anytime you are using interrupts (other than ON INTERRUPT), it interrupts things.
USB_ASM_Service uses USB interrupts that happen quite frequently.
Software timed routines like SEROUT2, PAUSE, PULSIN/OUT etc. Will lose time that they don't know about.
When using interrupts, Hardware devices should be use instead of software commands.
Instead of SEROUT2, use HSEROUT with the USART.
PAUSE ... use a timer.
PULSIN ... use a CCP module.
COUNT ... use a Timer
There are still many PBP commands you can use without problems.
But, if if they require specific timing thru software, that timing will be disturbed.
"No one is completely worthless. They can always serve as a bad example."
Anonymous
Bookmarks