Weact Studio RA4M1 64 Pin board. Plugging into USB red power LED on. Blue LED blinks but no USB-device detected

Hi everybody,

out of curiosity I ordered two Weact ra4m1 renesas r7fa4m1ab3cfm demo boards
https://de.aliexpress.com/item/1005006103872563.html

If I plug in an USB-C-cable into the board and into my computer
the red power-LED lights up and the blue LED D1 blinks 1 second on / 1 second of

But I can't hear any "USB-device detected sound" and If I look up the device-manager nothing happens.

So the code on the board seems to be running because the blue LED blinks but no device detected.

If I press the res-button the blue LED stays off
If I press the "MD"-button in the middle the blue LED keeps on blinking
if I press the button 013 the blue LED blinks faster in a pattern

Or is there something different with these renesas Weact ra4m1 controllers?

Must there be some different pins be used for programming?
Is some kind of programmer required?

I have looked up the GiPo

but haven't found any useful information

Are these boards just bad manufactured or is there some special hardware needed to flash code into the microcontroller?

The board that I have purchased looks like this one and as far as I have compared it the silk-screen printing is the same

any hints or links much appreciated

best regards Stefan

You may find this question strange.
The reason I am asking this is to understand how it is done with the R4.

I have used quite some different microcontrollers for Arduino-IDE
Uno, Mega, Nano, Teensy 4.0, 4.1
arduino Micro and Seeeduino XIAO, which have native USB.

I plugged them in and they were recognised as a COM-port-device by the OS windows.
I assume it is (basically) the same process on iOS and Linux

When looking at the Uno R4 board

There is only the renesas RA4M1 chip and a second chip which I assume is the buck converter chip.

So there is no additional USB to virtual COM-Port chip like CP2102, or CH340 or a ATmega16U2 like on Uno R3

I conclude that the RA4M1-chip itself has native USB.
Does this RA4M1-chip need some kind of bootloader to be recognised as a virtual USB-COM-Port?

I am asking this because I have bought a Weact studio RA4M1-Board and this board is not recognised as USB-device.

So could somebody explain to me how recognising the Uno R4 by the computer is done
or
post a link to a description that explains it

best regards Stefan

you didn't try Leonardo?
it is MCU native USB served by the sketch or bootloader

Oh I forgot to mention Arduino Leonardo.
Yes I tried Arduino leonardo (the small boards with ATmega32u4)

Or do you mean I shall choose Arduino Leonardo for uploading to a RA4M1-chip???
Does not makes sense to me.

And what does it exactly mean that a sketch can serve native USB???
connecting in a microcontroller to a computer which then makes the computer recognise a USB-device isn't done by a "sketch" except you write a sketch that is a HID-device

So does this mean without the bootloader a computer would NOT recognise USB-device connected??

best regards Stefan

It's the same as with every MCU with native USB: A software is needed to establish an USB connection. A bootloader or something else ( e.g. the Serial library ). But with an empty flash nothing happens.

Yes, the Sketch (or rather a library contained in the Sketch) does this on any board with native USB.
A native USB is a peripheral as all other pripherals, and you need some software to make it work. May be as HID or Serial or both.

maybe I am dumbing myself here. Still somehow confused as I don't know (yet) the deeper details how it works.

Whenever I have bought any kind of microcontroller with an USB-socket
It was sufficient to just connect this µC-board to my computer and the computer played the same sound as if you would plug in a USB-mouse, a USB-thumbdrive or external USB-harddisk or whatever USB-device
where this sound indicates "new USB-device found"

If this µC-board has a CH340-chip or CP2102-chip my assumption is all the details for establishing the USB-connection itself on the most basic level are done by the extra-chip.

If a microcontroller has native USB like a SAMD21 (Seeeduino SAMD21 XIAO) etc.
the µC has an internal part where establishing the USB-connection is done.

Is this correct?

Or does - on native USB-µ-controllers like SAMD21 - has to run a sepcial bootloader ?

I mean just that part that makes the new plugged in USB-device visible in the device-manager

best regards Stefan

What do you mean by 'internal part'? Of course it has an internal HW that is needed to establish an USB connection. But without beeing configured by software it does nothing.
It is not a stand-alone device like an external CP2102.

This answered my question. As I understand it now
microcontrollers with native USB if they are really "new born" require flashing a bootloader that is configuring the internal USB-hardware.

This very first bootloader-flashing is not done over USB-to-serial interface but with a more specialised flashing-device in a special procedure.

Applied to the Uno R4:

If I would de-solder the RA4M1-chip from the Uno R4 PCB and take a "new born" RA4M1-chip that was picked from the reel in the factory
and if I would solder this new born RA4M1-chip to the Uno R4-board
and then would plug in the USB-cable
nothing would happen as this "new born" RA4M1-chip does not yet have the bootloader

Is this correct?

Not really. The Renesas Ra4M1 processor has special boot modes with on chip routines and therefore can be programmed by USB even with a "new born" chip. These on chip routines are always there (ROM) and can be activated with setting of mode-pins.
But not every MCU with native USB has this feature. As far as I know, the SAM D21 doesn't have such fixed boot modes.

Every controller has a means of flashing without a 'bootloader'. E.g. the SAM D21 has its SWD interface, the AVR's can be programmed via ICSP.

rfp-cli -device ra -port $portname -p dfu_minima.hex

Hi @Juraj

thank you for posting the link

very new to flashing bootloaders.
Is this a linux command?

I have no idea yet where to type this command-line and what the prerequisites are that must be done for using it

To me, you are talking about two different things: That is the how is the processor programmed and USB.

Programming the board: some processors reserve a chunk of their ROM area, to have a code that runs when the processor is reset, that may handle things like programming the rest of the chip, etc. Others like the Teensy choose to have the programming down by a different chip.

There are plusses and minus with the different approaches. The Teensy for example, if you could hook up a hardware programmer to it, the programmer could not overwrite the code on the other chip. Whereas for example with AVR chips, it was not uncommon, that if you used a hardware programmer, you would wipe out the bootloader, and then to be able to program the chip over USB, you had to burn in the bootloader...

USB: To really understand this stuff, you need to look through the USB specifications, but a site I often go to is:

USB in a NutShell - Chapter 1 - Introduction (beyondlogic.org)

When you plug in a USB device into your computer (or hubs or ...), The thing that you plugged it into detects that it was plugged in. There is a hardware standard, where the signal wires on the USB have Pull up or Pull down resistors of some specific value on specific signals that tell the other device if you are Low speed (LS 1.5M), Full Speed (FS 12M), High Speed (HS 480M) and something different when you get up to USB 3...

When what you plug into detects you, it tries to start up a conversation, with what is plugged into it. Typically it will start off asking the board for it's device descriptor. This contains information like the Vendor ID, Product ID, Device type... Once it retrieves this information, it may then ask for the Configuration descriptors, and then the Interface Descriptors... Through all of this the system will detect if this thing into it is a something like a Serial Device and if so what type (CDC ACM, FTDI, ...) and load the appropriate drivers. Likewise it can detect if the device supports Keyboard, or Joystick or Mouse, or Tablet... and Again talk to those.

Now to your question: With processors that don't support USB natively (or choose not to use the support), you might choose to add that support through a different chip (FTDI, CP2102, PL2301, ...)
Pluses of this approach: When plugged in to USB, it is typically always active, regardless of the state of the main processor. Downside, flexibility. Typically a lot of these only support Serial communications. Speed or throughput: that is when that chip receives a packet from the host, it then has to send it to your main processor, often times over a hardware UART... likewise if send stuff from your sketch to the host, it goes out over a UART to the other chip, who then sends it...

For those, who have built in USB support, like the MNIMA or Teensy or.. It is easier to add the flexibility to configure the USB in many different ways, like Keyboard, joystick, mouse, Serial, multiple serial, ... Downside is if you sketch totally messes up, you could lose your USB communications. Likewise, when you download a new sketch, the Serial monitor drops out...

Then there is the odd duck: the UNO R4 WIFI, which also has an ESP32S3 processor on it. If your sketch is setup to run as USB Serial, the ESP32 has control over USB, and your communications of the main processor is to talk through a UART to the ESP32, who forwards the data to and from the host.... However, if you configure it for Keyboard or Mouse, then it switches a register, which connects it's USB pins to USB, and it does the USB communications. You also have the option to use a solder jumper to fix the USB to the main processor, which I have done with one of mine...

Sorry for rambling here!
Kurt

No problem. Interesting information that gives a brief overview how it works in principle.
Thank you very much for that.

I asked these details because I have some other RA4M1-chip-board.
I have asked for this RA4M1-chip-board in the programming questions subforum but got no answer yet

So next thing to do is to read about how to activate these boot-mode

best regards Stefan

You must held the MD-pin low while resetting the board. On an R4 this pin is labelled 'boot'. On your board it may be labelled differently. ( See chapter 3 of the renesas User's manual )

This weact.studio-board has a button named "MD"

The button seems to have this function.

Give it a try. Your board should show up in device-manager then.

Yes it shows up in the device-manager
image

After that I tried to follow this tutorial which is written for the Arduino Uno R4.

But as so very very often the tutorial is not really detailed.
Steps inbetween what to do are missing.
I managed to "get in contact" with the board.
Detecting the device was successful

But trying to upload the Uno R4-minima-bootloader failed.

When setting the chip into boot mode, there are two bootmodes according to the datasheet:
SCI-Boot Mode ( using the serial communication interface )
and
USB-Boot Mode ( using the USB interface )

I suppose you must select the correct interface in renesas flash programmer, This:
interface
( 2 wire UART ) seems the wrong one. But I don't know this flashing tool.

These modes are supported by the chip:

Programming in serial programming mode (SCI boot mode):
 Asynchronous serial interface (SCI9) used
 Transfer rate adjusted automatically.
Programming in serial programming mode (USB boot mode):
 USBFS used
 Dedicated hardware not required, so direct connection to a PC is possible.
Programming in on-chip debug mode:
 JTAG or SWD interface used

And I think in the flashing tool you must select the according interface how your board is connected.

I merged the two topics on this subject per @StefanL38's request.

Carry on.