-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for JN5169 #1
base: master
Are you sure you want to change the base?
Conversation
Adding support for JN5169. Adding support for macOS.
Source/JN51xx_BootLoader.c
Outdated
| u32Divisor = 1000000 / u32Baudrate; | ||
|
|
||
| // Divide 1MHz clock bu baudrate to get the divisor, round to closest | ||
| u32Divisor = (1000000+u32Baudrate/2) / u32Baudrate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct settings for other devices?
|
Thanks very much for your cool PR. And also please keep commit with the code style before. Thanks. |
|
Hi,
I was starting to do as you asked, but I saw you were at it... So do you want me to do anything?
PS: I agree that having mixed coding styles is very ugly, but don’t complain to me if a bug appears with the original coding style ;oP More seriously it is mostly a question of taste EXCEPT when it comes to if/for/while/etc blocks that are not surrounded by curly brackets, this has bitten me so many times! (Plus all the times spending minutes to try and match brackets after copy/paste...)
PPS: could the code be changed to GPL?
PPPS: if you are NXP, do you have more docs about the chip? The doc for the boot loader is not up to date and come on, just because you provide a lib doesn’t mean coders do not need the chip’s register description!
Cheers,
Jérôme.
… Le 17 janv. 2018 à 07:45, qinfengling ***@***.***> a écrit :
Thanks very much for your cool PR.
Could you split it to 2 commits ?
I will merge the macOS first.
And also please keep commit with the code style before.
Thanks.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Well, this is not a question of device, it is a question of integer math.
The base frequency is 1000000Hz, so you can’t have 115200, only 111111... or 125000. The closest is 111111 (-3.5% error). 125000 is out of RS-232 specs with (8.5% error).
Basically adding half the value you divide, adds 0.5 to the value before truncating.
This gives the correct (as indicated in the JN-AN-1003 boot loader data sheet) 9 for 115200 and 26 for 38400.
Cheers,
Jérôme.
… Le 17 janv. 2018 à 07:43, qinfengling ***@***.***> a écrit :
@qinfengling commented on this pull request.
In Source/JN51xx_BootLoader.c:
> @@ -664,9 +742,11 @@ teStatus BL_eSetBaudrate(int iUartFd, uint32_t u32Baudrate)
uint8_t au8Buffer[6];
uint32_t u32Divisor;
- // Divide 1MHz clock bu baudrate to get the divisor
- u32Divisor = 1000000 / u32Baudrate;
-
+ // Divide 1MHz clock bu baudrate to get the divisor, round to closest
+ u32Divisor = (1000000+u32Baudrate/2) / u32Baudrate;
Is this correct settings for other devices?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Keep going. Fengling |
Yay! Lightning fast 1MBaud flashing on macOS!
Adding support for JN5169.
Adding support for macOS.