Search found 23 matches

by TadyTheFish
Wed Mar 11, 2020 9:56 pm
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

Well i tried the 1/2 stop bit and it seems the PLC is now reading the whole message at once.. So there is some success. But I still have sync errors.. I will try some more😁
by TadyTheFish
Tue Mar 10, 2020 3:33 pm
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

Ok I just remembered something.. I hope I'm not an idiot but coul it be that I have a fake chip? I did buy the bluepill of ebay for a funny price?
I could test the software on a pyboard but that one has 405 chip and I think it is not suppored by the core
by TadyTheFish
Tue Mar 10, 2020 1:04 pm
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

CR2 is 0x0
I tried Serial.write(byte); in a while loop and then Serial.flush();
And I tried Serial.write(buff,lenght); exactly the same result

Yes tomorow I can try thw libmaple core but I will need to redo the interrupt timers that I need for sync timeout and such
by TadyTheFish
Tue Mar 10, 2020 11:03 am
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

I just hooked up the mega328 slave that is working.
the gap between bytes is the same as the gap from the PLC. It starts a new byte as soon as the parity bit is sent
It seems that the mega USART woks differently as of the one on the STM
by TadyTheFish
Tue Mar 10, 2020 10:04 am
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

Sorry I misslead you.. I only posted the relevant 13 bits.
So to summarize everything cheks out?
9bits is set because of the extra parity bit?
by TadyTheFish
Tue Mar 10, 2020 9:36 am
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

You said that the top two bits should be zero. Bit13 is USART enable.. this one should be 1 like it is

Code: Select all

Serial2.begin(BAUD,SERIAL_8E1);
Serial1.println(((USART_TypeDef *) USART2_BASE)->CR1,BIN);
gives me

Code: Select all

0b11010100101100
by TadyTheFish
Tue Mar 10, 2020 9:21 am
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

The prevoious post was incorrect. It was for Serial1. I am using Serial2
by TadyTheFish
Tue Mar 10, 2020 9:02 am
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

Aaaaa ok that clears things. I will play around but that pause between bytes is for sure causing me problems. But I agree it shouldn't be a problem since we have a start and a stop bit. Maybe Profibus works different
Thank you
by TadyTheFish
Tue Mar 10, 2020 8:25 am
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

I did some digging Serial2.begin(19200,SERIAL_8E1); Serial.println(((USART_TypeDef *) USART2_BASE)->CR1,BIN); gives me 11010100101100 The data sheet says bit12 of the CR1 register is the word length 0 = 8bits 1= 9 bits So looking at the output it seems it is set to 9 bit word length But if I set the...
by TadyTheFish
Mon Mar 09, 2020 8:21 pm
Forum: General discussion
Topic: STM32F103 Bluepill UART problem
Replies: 45
Views: 26205

Re: STM32F103 Bluepill UART problem

Ok thank you for your time for looking into this. I understand that it takes time to put a new byte to the buffer but the thing that bothers me is that the time changes exactly as the baudrate does. It is always 1bit long and I don't understand how the CPU can put the new byte in to the buffer faste...

Go to advanced search