Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macos nonstandard baudrates #898

Merged
merged 3 commits into from
Mar 19, 2022
Merged

Conversation

dl8dtl
Copy link
Contributor

@dl8dtl dl8dtl commented Mar 7, 2022

Supposed to fix issue #771

dl8dtl added 3 commits March 7, 2022 23:20
Alas, MacOS doesn't handle nonstandard baud rates like other systems
in regular tcsetattr() calls. Instead, they invented a new ioctl
(IOSSIOSPEED). So, if we notice we are going to configure a
nonstandard rate on MacOS, issue that ioctl after configuring
everything else using tcsetattr().
Got accidentally committed.
@MCUdude
Copy link
Collaborator

MCUdude commented Mar 8, 2022

Thanks for the PR, I can confirm that it works properly on my machine too (macOS 10.14)
However, maybe it's time to not make the custom baud rate "warning" a little nicer? A non-standard baud rate won't really be a problem on any platform anymore. (EDIT: or at least change verbosity level to MSG_NOTICE2?)

This is how it currently looks like:

$ ./avrdude  -C avrdude.conf -p atmega1284p -c arduino -b 500000 -P /dev/cu.usbserial-1410 -v

avrdude: Version 6.99-20211218
         Copyright (c) Brian Dean, http://www.bdmicro.com/
         Copyright (c) Joerg Wunsch

         System wide configuration file is "avrdude.conf"
         User configuration file is "/Users/hans/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbserial-1410
         Using Programmer              : arduino
         Overriding Baud Rate          : 500000
avrdude: serial_baud_lookup(): Using non-standard baud rate: 500000
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

It would be nice if it perhaps looked something like this instead:

$ ./avrdude  -C avrdude.conf -p atmega1284p -c arduino -b 500000 -P /dev/cu.usbserial-1410 -v

avrdude: Version 6.99-20211218
         Copyright (c) Brian Dean, http://www.bdmicro.com/
         Copyright (c) Joerg Wunsch

         System wide configuration file is "avrdude.conf"
         User configuration file is "/Users/hans/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbserial-1410
         Using Programmer              : arduino
         Overriding Baud Rate          : 500000 (non-standard)
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

BTW, the last commit could be dropped if you rebase your first commit. Adding something to a file and then removing the same code in another commit isn't preferable.

@MCUdude
Copy link
Collaborator

MCUdude commented Mar 8, 2022

Should this be applied to serbb_posix.c as well?

@dl8dtl dl8dtl merged commit 99f191a into avrdudes:main Mar 19, 2022
dl8dtl added a commit that referenced this pull request Mar 19, 2022
@MCUdude
Copy link
Collaborator

MCUdude commented Mar 20, 2022

Should this be applied to serbb_posix.c as well?

@dl8dtl would be great if you could clarify. I've never used a serial bit-banging programmer myself, so I don't really know.

@dl8dtl
Copy link
Contributor Author

dl8dtl commented Mar 20, 2022

As serbb* abuses the serial connection to perform bit-banging, I don't think arbitrary baudrates are of concern there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants