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

MMC serial terminal on Linux #542

Open
jbqubit opened this issue Apr 13, 2018 · 10 comments
Open

MMC serial terminal on Linux #542

jbqubit opened this issue Apr 13, 2018 · 10 comments
Assignees
Milestone

Comments

@jbqubit
Copy link
Collaborator

jbqubit commented Apr 13, 2018

The fourth serial interface exposed by Sayma over USB is MMC Console. How to use it is discussed here and here. The MMC terminal works in FlashMagic and Terminalbpp, both on Windows. But I can't get this to work under linux.

Here's what I'm doing.

  • 115200 8N1
  • no hardware handshaking =
  • minicom on Linux configured as follows (minicom -D /dev/ttyUSB4)
$ cat ~/.minirc.dfl
# Machine-generated file - use setup menu in minicom to change parameters.
pu port             /dev/ttyUSB4
pu rtscts           No
pu linewrap         Yes
pu addcarreturn     Yes

What I observe: nothing in minicom.

@gkasprow
Copy link
Member

Are U sure that the MMC did not enter the bootloader mode ?

@hartytp
Copy link
Collaborator

hartytp commented Apr 13, 2018

@jbqubit As @gkasprow says, this doesn't work under linux for some reason as the MMC enters bootloader mode. I removed a jumper wire to get it to work with Linux. Which is a PITA, as I now have to solder it to refresh and desolder it connect to the terminal.

You can find details in the 1V8 thread.

@gkasprow
Copy link
Member

You can solder tiny SMT DIP switch. I will add such one in rev2.

@hartytp
Copy link
Collaborator

hartytp commented Apr 14, 2018

Is that necessary? Can't the firmware be made more robust?

Cant we do something like use a magic string sent over the uart to restart into boot loader so the uart works by default? It would also be great if firmware was done using a simple python program rather than flash magic.

@gkasprow
Copy link
Member

This bootloader is carved in stone and cannot be changed.
We can however write own bootloader or use one developed for Open MMC and disconnect lines responsible for programming.
Another idea is to add some logic that would trigger the update sequence only with certain IO state on FTDI chip

@hartytp
Copy link
Collaborator

hartytp commented Apr 14, 2018

@gkasprow I don't mind too much how we do this, but I think it is important to have flashing robust and automated. I.e.not relying on users to toggle dip switches. Id also like a simple command line script I can run to do this like the artiq_flash script, which works on both windows and Linux.

@gkasprow
Copy link
Member

This can be done with Open MMC bootloader developed by LNLS. We can add the switch as temporary / emergency solution and implement automated approach.

@jbqubit
Copy link
Collaborator Author

jbqubit commented Apr 16, 2018

@gkasprow Have you tried the Open MMC bootloader developed by LNLS?

@jbqubit jbqubit added this to the Sayma v2.0 milestone Apr 16, 2018
@sbourdeauducq
Copy link
Member

Is that necessary?

This has to do with the status of the serial port control lines. It is possible to make it work under Linux without touching the hardware: in another issue, I posted a hacky C program that resets the control lines and makes the Sayma not enter the bootloader. It is possible to integrate it into a serial port terminal program, which would make using the MMC console relatively seamless.

It would also be great if firmware was done using a simple python program rather than flash magic.

Sure.

You can also use OpenOCD and a JTAG cable, though they are not very reliable IME.

@sbourdeauducq
Copy link
Member

#include <sys/ioctl.h> //ioctl() call defenitions
       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>
main()
{
           int fd;
              fd = open("/dev/ttyUSB_sayma-3_2",O_RDWR | O_NOCTTY );//Open Serial Port
                
                 int RTS_flag;
                    RTS_flag = TIOCM_RTS;
                       /*ioctl(fd,TIOCMBIS,&RTS_flag);//Set RTS pin
                          getchar();*/
                             ioctl(fd,TIOCMBIC,&RTS_flag);//Clear RTS pin
                                close(fd);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants