Author Topic: Microcontroller suggestion  (Read 2407 times)

0 Members and 1 Guest are viewing this topic.

Offline fabiodlTopic starter

  • Frequent Contributor
  • **
  • Posts: 282
Microcontroller suggestion
« on: June 04, 2023, 04:12:39 am »
I would like a microcontroller with the following features:
- it exposes a parallel address/data/control bus, to which I can connect memory mapped devices (like a  motorola 68000)
- it has a wait/ready line which can make it halt during a read write (again, like a motorola 68000)
- its toolchain is open source and well supported
- it is not a softcore (i.e. it is not picorv32 )
- it is relatively fast (just to give an idea, over 1 MIPS)
- it is under 20 bucks
- it is currently sold
- bonus points if the default library supports floating point operations, i.e. it has enough ram /rom to support newlib or it uses avrlib
- bonus points if it's risc-v based
 

Offline dobsonr741

  • Frequent Contributor
  • **
  • Posts: 643
  • Country: us
Re: Microcontroller suggestion
« Reply #1 on: June 04, 2023, 04:31:22 am »
RP2040 with the PIO emulating the bus.
 
The following users thanked this post: fabiodl

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Microcontroller suggestion
« Reply #2 on: June 04, 2023, 04:46:04 am »
RP2040 with the PIO emulating the bus.

Yes, the only downside is the limited number of GPIOs. That's quickly going to be a problem for interfacing parallel memory with an address, data and control bus.

Another option would probably be the much beefier and more expensive NXP iMXRT 106x series. Very flexible interfacing, many more GPIOs, much more powerful, and still below the 20 bucks mark.

For other common MCUs, that'll be hard to fit the bill. Many have some kind of memory interface, such as STM32's FSMC, but while it can be configured in various ways with configurable wait states and such, I don't think it's capable of doing the handshaking (the OP's wait/ready line.) This last point will restrict the choice of MCU drastically.
 
The following users thanked this post: fabiodl

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 3971
  • Country: nz
Re: Microcontroller suggestion
« Reply #3 on: June 04, 2023, 08:02:32 am »
I would like a microcontroller with the following features:
- it exposes a parallel address/data/control bus, to which I can connect memory mapped devices (like a  motorola 68000)

That is just about the definition of "What is the difference between a microprocessor and a microcontroller".

You can always implement whatever external bus you want using GPIOs if you have enough of them and the bus doesn't have to operate at super high speed.

ATMega2560 supports external RAM (or whatever) in hardware using PG0-2 for control and PA0-7 and PC0-7 for the address. D0-D7 use the same pins as A0-A7 so you need an external latch for the low address bits. External memory adds 1 wait state I believe.

Quote
- it has a wait/ready line which can make it halt during a read write (again, like a motorola 68000)

No idea. Of course if you implement everything yourself using GPIOs then you can do whatever you want.

Quote
- its toolchain is open source and well supported
- it is not a softcore (i.e. it is not picorv32 )
- it is relatively fast (just to give an idea, over 1 MIPS)
- it is under 20 bucks
- it is currently sold
- bonus points if the default library supports floating point operations, i.e. it has enough ram /rom to support newlib or it uses avrlib

All easy.

Quote
- bonus points if it's risc-v based

Harder.

Kendryte K210 has 8 MB of internal RAM and supports 8 MB of hardware-controlled external SPI RAM (which could of course be MMIO if you want).
 
The following users thanked this post: fabiodl

Offline hans

  • Super Contributor
  • ***
  • Posts: 1621
  • Country: nl
Re: Microcontroller suggestion
« Reply #4 on: June 04, 2023, 12:39:48 pm »
Look at F(S)MC of STM32F4, and possibly also present in other families (e.g. F2 F7 H7). In NOR/PSRAM mode it has a NWAIT signal that is an input to the MCU to wait on the memory device. The downside is that the data D[15:0] and address A[25:16] + A[15:0] is partially multiplexed.
These devices can support a reasonably large address space plus a 32-bit data bus.

One thing to test is whether that mode supports reads and writes, and how the asynchronous behaviour then works.
For example, the QuadSPI controller in some STM32 devices could also be memory mapped, but was only intended for reads from FLASH as it only supported a single instruction opcode to initiate random addressing. If it was used in direct mode, it could do both read and writes.

I think many other memory busses will have controllers that communicate in terms of synchronous transactions, and assumes a fixed number of dummy clocks (as latency) before the memory device will reply. That's how a lot of these FLASH and S(D)RAM chips work anyway.

I'm not sure if its an exact for the devices you want to communicate with. I think other options would quickly converge to a FPGA, but I will not challenge the presumption that 'no softcore' also means no FPGA/custom logic fabric solution (be it glue or as a complete controller).
« Last Edit: June 04, 2023, 12:42:23 pm by hans »
 
The following users thanked this post: fabiodl

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4384
  • Country: dk
Re: Microcontroller suggestion
« Reply #5 on: June 04, 2023, 12:57:06 pm »
1 MIPS is slow, as long as you have enough pins you could easily bitbang a memorymapped device with a wait 
 
The following users thanked this post: fabiodl

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26682
  • Country: nl
    • NCT Developments
Re: Microcontroller suggestion
« Reply #6 on: June 04, 2023, 05:04:35 pm »
Some of NXP's LPC1800 series microcontrollers have an external memory interface (called EMC as in external memory controller). IIRC the LPC1700 series has these as well on some models.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 
The following users thanked this post: fabiodl

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: ca
Re: Microcontroller suggestion
« Reply #7 on: June 04, 2023, 10:11:12 pm »
Winchip CH32V307.V package (qfp 100) meets most of your requirements, with a question mark about the wait line. Would need to read the datasheet concerning the external memory interface.

Nice and relatively cheap around $3.50 usd. RISC V core at 144Mhz.

Edit: RP 2040 also could work, if you run out of GPIO as SiliconWizard comments you can multiplex and latch the address bus in external latches like 74hc373. The PIO could do this easily.
« Last Edit: June 04, 2023, 10:16:25 pm by chickenHeadKnob »
 
The following users thanked this post: fabiodl

Offline djacobow

  • Super Contributor
  • ***
  • Posts: 1151
  • Country: us
  • takin' it apart since the 70's
Re: Microcontroller suggestion
« Reply #8 on: June 04, 2023, 10:23:39 pm »
Sounds to me like you might be happier using shift registers and a little glue to emulate an old school address+data bus rather than have it be the processor's actual bus. For this you could use just about any modern controller for the processor, 595's for the address bus, some kind of io expander for the data bus (or make something out of two kinds of shift registers, 595 for "writing" and 165 for "reading"), using controller GPIO to control them as well as serve as the control signals for bus devices.

You'll get much more than 1 MIPS this way and your bus can still go as fast or slow as you need.

I think it would be more fun to do it this way, too.
 
The following users thanked this post: fabiodl

Online westfw

  • Super Contributor
  • ***
  • Posts: 4192
  • Country: us
Re: Microcontroller suggestion
« Reply #9 on: June 04, 2023, 10:34:26 pm »
Quote
it has a wait/ready line which can make it halt during a read write
I don't think I've ever seen a "microcontroller" with a wait/ready line.  In fact, it seems to be one of the first things to disappear even on "microprocessors" with internal memory decoding (80186, 6833x, etc) (IIRC, they also do internal wait-state generation on a per-decode basis, so you don't have to do it externally.)

 
The following users thanked this post: fabiodl

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Microcontroller suggestion
« Reply #10 on: June 04, 2023, 10:47:22 pm »
As langwadt said though, unless the OP has strict timing requirements regarding memory access (in the sense of some jitter would be unacceptable, which I doubt here), that we can assume would not be required to be done at a higher frequency than 1MHz, it could be all bit-banged with pretty much any 32-bit MCU running at a few tens of MHz. So if RISC-V is required, pick one of the avaiaible ones such as what chickenHeadKnob suggested.

The only additional thing to know is, would this external memory access have to be "transparent" to the MCU core itself? (Meaning, transparently with just load/store instructions?)
If so, that might still be doable with bit-banging, implementing an exception set to trigger upon memory access to the address space you would define for this external memory.
Even with an exception in between, at 144MHz you should be able to work it out, although you'd have to look at the worst-case latency for exception handling on the particular MCU you're gonna use. And probably you'll need one with PMP too (to set up the exception).

 
The following users thanked this post: fabiodl

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Microcontroller suggestion
« Reply #11 on: June 04, 2023, 10:58:59 pm »
Your requirements preclude any microcontroller ever made that I'm aware of, what you are describing is a microprocessor. With sufficient IO pins or an IO expander chip you could create your own bus, but it won't be the internal bus used by the core.
 
The following users thanked this post: fabiodl

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9875
  • Country: nz
Re: Microcontroller suggestion
« Reply #12 on: June 04, 2023, 11:53:12 pm »
ATMega162 is another one with external memory space (64KB)
I'm not too sure about the "wait/ready line" requirement. it has a read/write stobe and addr latch enable.
Runs up to 16 MIPS.
« Last Edit: June 04, 2023, 11:55:07 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 
The following users thanked this post: fabiodl

Offline barshatriplee

  • Regular Contributor
  • *
  • !
  • Posts: 130
  • Country: bd
Re: Microcontroller suggestion
« Reply #13 on: June 05, 2023, 07:21:40 am »
You can consider ESP32: https://www.theengineeringprojects.com/2021/11/introduction-to-esp32-programming-series.html

This is based on RISC-V  architecture. The speed is 600 DMIPS.
 
The following users thanked this post: fabiodl

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 3971
  • Country: nz
Re: Microcontroller suggestion
« Reply #14 on: June 05, 2023, 11:11:37 am »
You can consider ESP32: https://www.theengineeringprojects.com/2021/11/introduction-to-esp32-programming-series.html

This is based on RISC-V  architecture. The speed is 600 DMIPS.

The link you give is to older ESP32 models that use Xtensa ISA not RISC-V.

Only newer models such as ESP32-C3 and -C6 use RISC-V.
 
The following users thanked this post: fabiodl

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8090
  • Country: fi
Re: Microcontroller suggestion
« Reply #15 on: June 05, 2023, 12:46:00 pm »
Microcontroller speed was discussed (~1MIPS), but how about the speed of that specific bus? Something like 1MHz would be trivial to bit-bang, or even interrupt-driven in background if you want ease of programmability of everything else. Make it 10MHz and it becomes tremendously more difficult, maybe something like STM32's FSMC with some extra glue logic to handle the wait/ready business. But at low enough bus clock speed, software solution gives you most flexibility.
 
The following users thanked this post: fabiodl

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4384
  • Country: dk
Re: Microcontroller suggestion
« Reply #16 on: June 05, 2023, 01:59:25 pm »
Microcontroller speed was discussed (~1MIPS), but how about the speed of that specific bus? Something like 1MHz would be trivial to bit-bang, or even interrupt-driven in background if you want ease of programmability of everything else. Make it 10MHz and it becomes tremendously more difficult, maybe something like STM32's FSMC with some extra glue logic to handle the wait/ready business. But at low enough bus clock speed, software solution gives you most flexibility.

it does look like the STM32 FMC (not FSMC) supports SRAM and external wait
 
The following users thanked this post: fabiodl

Offline wek

  • Frequent Contributor
  • **
  • Posts: 476
  • Country: sk
Re: Microcontroller suggestion
« Reply #17 on: June 05, 2023, 02:17:29 pm »
it does look like the STM32 FMC (not FSMC) supports SRAM and external wait
FMC is the same module as FSMC, except for added SDRAM support (yes, feature added, letter removed).

In other words, FSMC does support external wait, too, through FSMC_NWAIT pin.

JW
 
The following users thanked this post: fabiodl

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8090
  • Country: fi
Re: Microcontroller suggestion
« Reply #18 on: June 05, 2023, 02:44:35 pm »
With those peripherals, devil is always in details. I would suggest committing some time by mega carefully reading the STM32 reference manual about their F(S)MC peripheral, to see if the mentioned WAIT feature does exactly what you need. Another way is to pick some evaluation board and just start experimenting and try it out. Or both.
 
The following users thanked this post: fabiodl, langwadt

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Microcontroller suggestion
« Reply #19 on: June 05, 2023, 08:38:19 pm »
With those peripherals, devil is always in details. I would suggest committing some time by mega carefully reading the STM32 reference manual about their F(S)MC peripheral, to see if the mentioned WAIT feature does exactly what you need.

Indeed.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26682
  • Country: nl
    • NCT Developments
Re: Microcontroller suggestion
« Reply #20 on: June 05, 2023, 09:10:38 pm »
Look at NXP first  8) More mature peripherals and better documentation. Recently I have been involved in some projects that use STM32 but I'd take NXP's LPC series microcontrollers over STM32 any day of the week. IOW: If you are not working on high volume projects where price is important, don't start looking at ST to select a microcontroller.
« Last Edit: June 05, 2023, 09:12:39 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 
The following users thanked this post: fabiodl

Offline fabiodlTopic starter

  • Frequent Contributor
  • **
  • Posts: 282
Re: Microcontroller suggestion
« Reply #21 on: June 05, 2023, 11:58:15 pm »
Thank you everybody. The term F(S)MC was fundamental for me (I googled for "external bus" which lead to much worse results). STM32 seems the most fitting, but the CH32V307 is as interesting as hell.

Look at NXP first  8) More mature peripherals and better documentation. Recently I have been involved in some projects that use STM32 but I'd take NXP's LPC series microcontrollers over STM32 any day of the week. IOW: If you are not working on high volume projects where price is important, don't start looking at ST to select a microcontroller.

how is that so? To give some context, I want to develop under linux and with less proprietary stuff as possible
 

Offline Georgy.Moshkin

  • Regular Contributor
  • *
  • Posts: 143
  • Country: hk
  • R&D Engineer
    • Electronic projects, modules and courses on Arduino and STM32
Re: Microcontroller suggestion
« Reply #22 on: June 06, 2023, 01:56:08 am »
Also note PSSI interface (tx/rx 50/100 MHz) that some STM32's have. Although it is not exactly what you are looking for, it is worth knowing before you make a final decision on the chip


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf