adafruit / uf2-samdx1

MSC bootloader (based on UF2) for SAMD21
Other
210 stars 182 forks source link

Problem Program SAMD51 from UART1 (SERCOM3) - Metro M4 AirLift #178

Open sergioxdev opened 2 years ago

sergioxdev commented 2 years ago

Hi Guys

I am testing the grand central meter, i would like to program this chip from another uart input, other than native usb, switching from usb to another uart via a pin.

Any info are accepted

sergioxdev commented 2 years ago

Hi Guys I update you, doing research I found the following posts:

I am tested it a metro m4 airlift, because i want to update the SAMD51 via serial UART,

  1. I made these changes to the uf2.h file // ------------------------------------------------ ---------

    define USE_LOGS 0

    define USE_ASSERT 0

    define USE_FAT 0

    define USE_INDEX_HTM 0

    define USE_CDC 1

    define USE_UART 1

    define USE_HID 0

    define USE_WEBUSB 0

    define USE_MSC 1

define USE_SINGLE_RESET 1

define USE_HID_SERIAL 0

define USE_HID_EXT 0

define USE_HID_HANDOVER 0

define USE_MSC_HANDOVER 0

define USE_MSC_CHECKS 0

define USE_CDC_TERMINAL 0

define USE_DBG_MSC 0

// ------------------------------------------------ ---------

  1. I connected a FT232R on the RX / TX pins of the metro

  2. I try to send the same bytes as the BOSSA, "0x4e, 0x23, 0x56, 0x23", to start the boot programming

but I don't get any response some suggestions, to understand where I'm wrong Thanks in advance

sergioxdev commented 2 years ago

Hi Guys

I update you, doing some debugging I found the problem

uf2-samdx1/src/main.c

https://github.com/adafruit/uf2-samdx1/blob/2fd0593fbc7dd12a13b2b4e6dc281fb5b54464b9/src/main.c#L306

the problem is about usart_sharp_received ()

going backwards.

uf2-samdx1/src/usart_sam_ba.c

https://github.com/adafruit/uf2-samdx1/blob/2fd0593fbc7dd12a13b2b4e6dc281fb5b54464b9/src/usart_sam_ba.c#L170

the problem is about usart_is_rx_ready ()

going backwards.

https://github.com/adafruit/uf2-samdx1/blob/2fd0593fbc7dd12a13b2b4e6dc281fb5b54464b9/src/usart_sam_ba.c#L177

the problem is here, however FT232R is connected with the RX / TX pins of the Metro, I try to send "#" on the serial, but usart_is_rx_ready () always returns false;

I also tried always on main to send a byte on UART1 (SERCOM3) with: usart_putc (1); but it does not send anything

Any suggestions