I’ve a peculiar problem using usart (Serial1). I’ve modified the core firmware to initialize USARTserial as 8 bit, 1 stop bit, even parity, no flow control (it actually makes 7 data bits when you add a parity bit, according to documentation).
Anyways, it works just as expected when I initialize the baud rate anything higher than (including) 600. But when I try to initialize it with 300 baud rate, it does not communicate. I just receive garbled characters on the other end.
I’ve tried to test with several different computers and even a data logger that can record serial comm. but they all displayed garbled chars. Just as if the MCU can not clock its USART correctly.
I would like to state once more, any baud rate from 600 transmits and receives OK.
Not sure what settings you changed to get the baud rate to 300 but i’m looking at datasheet and you might want to calculate the error that might according that do a little adjustment to the value you use on USART_BRR and USARTDIV to minimize it
Another way i thought of is simply to run Serial1 as the normal 9bit, 1 stop first @ 300 to make sure things are working well 1st.
I was trying to use the Spark Core to communicate on a bus that’s using a baud rate of 500bps, and I am having the same problem, that 600bps was the lowest baud rate that would work. I was wondering if you knew how to modify the USART_BRR and USARTDIV registers to achieve lower baud rates. I was successful at using an Arduino to communicate with the other devices on the bus, so I know that 500bps will work.
Yes that’s correct. Sorry for the delay but I wanted to test it again.
Here’s the code I used to test with.
void setup() {
Serial.begin(9600);
Serial1.begin(500);
}
void loop() {
while (Serial1.available())
{
Serial.print("Received: ");
Serial.println(Serial1.read(), DEC);
Serial1.flush();
}
delay(500);
}
```
I tested it with an Arduino sending bytes in a loop. When I set the baud rate on both devices to 500 I receive a "0" on the spark core, and when I set the baud to 600 or 9600 I receive the correct bytes the arduino is sending.
I know this is an old thread, but I was also trying to get the Photon to work with a device that only operates at 300 baud. Doing some digging it looks like it’s a hardware issue with the actual chip that wasn’t designed to go below 1200. The documentation however does list communication as anything from 300 - 115200. It should be noted that 115200 is the correct maximum.
The problem here is that the divisors can’t get the bus clock down low enough.
The slowest you can go is = bus clock / 4095 / 16. When the bus clock is 30MHz, that’s 457bps.
(4095 = maximum UART BRR divisor, 16 = UART oversampling)
If you slow the APB the UART is on down to 15MHz then you can get 300bps working. That’ll affect every peripheral on the bus though, which includes timers, other UARTs etc.
The UARTs go a LOT faster than 115,200 though - up to 3.75 or 7.5Mbps at the top end (divisor = 1, 8x oversampling, 60MHz bus clock).
I too realize this is an oldish thread, but I’ve been trying to hook up a Core to an old LED storefront display I have lying around. It communicates at 300 baud (8N2).
After spending a bunch of time wondering why I can’t get it working, and then finally trying to troubleshoot and noticing most stuff is working at 1200baud and up against a USB-Serial Adapter on my Mac, I arrived at this thread.
@Horganic, the Photon cannot support anything lower than 1200baud. You may be able to use @ScruffR’s ParticleSoftwareSerial library on Particle Build which seems to support 300baud.