ATTiny2313/4313 Flowcode development board

Use this section to discuss your embedded Flowcode projects.
mnfisher
Valued Contributor
Posts: 2018
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

ATTiny2313/4313 Flowcode development board

Post by mnfisher »

I made a small ATTiny4313 dev board. The MCI can run at up to 20MHz (or 8MHz internal)

I breadboarded and it worked well, although the connection to the programmer was a little 'delicate'

So using an ElectroCookie solderable breadboard i set to make a version with an ICSP header.

This entailed cutting three tracks - and i also added a jumper to allow external power. Originally i had a 10K pull up resistor to pin 1 (reset) bit I removed, when testing failed. It seems okay on the internal pull-up but might be good to re-add.
PXL_20260527_133639488.MP~2.jpg
PXL_20260527_133639488.MP~2.jpg (212.32 KiB) Viewed 325 times

mnfisher
Valued Contributor
Posts: 2018
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

Re: ATTiny2313/4313 Flowcode development board

Post by mnfisher »

I had most difficulty soldering the header pins - some melting has occurred on my VCC jumper :-(

I hit two problems - it didn't work ( a biggy) - i checked the board carefully and I hadn't bridged the links in the power/ground rails..

Still no joy - and attaching a scope, I see that reset doesn't pull low. I removed the 10K resistor :-(

Programming the chip separately (I knew the socket was a good idea) convinced me that the MCU was running okay (blinkie) - so I checked the wiring again!

Then I noticed that I had plugged the programmer cable into the UDP port - doh..

I wrote a small batch file for Flowcode (I used a Diamex programmer) - and all works well....

I'll post after I've polished it a bit... FC doesn't allow a USB port to be specified for ATTiny chips - and hardcoding it seems excessive ('USB' doesn't do it)

So I'll peek at the definition file (and maybe get some pointers from Steve?) to allow this to be set!

Martin

mnfisher
Valued Contributor
Posts: 2018
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

Re: ATTiny2313/4313 Flowcode development board

Post by mnfisher »

... and I forgot to connect VCC to pin 20...

Which took rather longer to notice than you'd hope :-(

Steve-Matrix
Matrix Staff
Posts: 1902
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 281 times
Been thanked: 445 times

Re: ATTiny2313/4313 Flowcode development board

Post by Steve-Matrix »

Ben is more familiar with that part of FCD files than I am, but I think it's one or both of these 2 sections you need to pay attention to:

The first is the use of the batch files and the "UsesComm" and "$(comport)" of the <programmer> section within <build>.

The second is the <comminfo> entries which allow you to specify a VID/PID pairing

mnfisher
Valued Contributor
Posts: 2018
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

Re: ATTiny2313/4313 Flowcode development board

Post by mnfisher »

I think I'm almost there - I created a fcd file AT4313_Dev_Board - and copied across the 'programmer' lines from a device that has a COM port (I used Arduino Uno) - this seems good - with the proviso that 'upload configuration now' gives fuse memory is undefined. I've not altered the fuse settings - and only one byte is offered in configuration. Should there be a H(igh) and a L(ow) byte?

Martin

Steve-Matrix
Matrix Staff
Posts: 1902
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 281 times
Been thanked: 445 times

Re: ATTiny2313/4313 Flowcode development board

Post by Steve-Matrix »

Sorry, I don't know about this particular chip. But the "E-Blocks2 AVR Programmer" fcd might hold a clue. This one has the following section and maybe you need something similar:

Code: Select all

    <configuration address='0x0000' mult='1' progonly='1' >
        <format><byte address='Low' value='0xFF' /><byte address='High' value='0xDF' /><byte address='Extended' value='0xFF' /></format>
        <setting />
        <settings >
            <setting name='SUT_CKSEL' offset='0' mask='63' bits='6' hint='Select Clock Source' >
                <option name='Ext. Clock, Start-up time PWRDWN/RESET: 6 CK/14 CK + 0 ms' value='0' />
                <option name='Ext. Clock, Start-up time PWRDWN/RESET: 6 CK/14 CK + 4.1 ms' value='16' />

                ...etc...

mnfisher
Valued Contributor
Posts: 2018
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

Re: ATTiny2313/4313 Flowcode development board

Post by mnfisher »

Thanks, I'll have another rummage through the fcd files.

It all seems to work quite smoothly for programs which is good.

Auto-detect doesn't pick the com port, but manually selecting it is fine. Using a long name looks a bit odd on the 'quick start' buttons - so a better name is needed.

Martin

mnfisher
Valued Contributor
Posts: 2018
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

Re: ATTiny2313/4313 Flowcode development board

Post by mnfisher »

The description and programmer files.

I feel - something isn't quite right, but it does work. Oddly - after doing new project with ATTINY4313_dev_board as the project type - in options etc - the type shows up as ATTiny4313. However - if you choose this then the programmer speed etc are incorrect (8MHz instead of 20MHz and no USB port)?? The fcdx file maybe needs a CRC ??

Also - if you do new project - choose one type (say ATTiny4313) then doing 'back' and choosing the other (ATTiny4313_dev_board) - doesn't reset the options. Odd - and this only happens between the 4313 / 4313_dev_board files - and if I close / reopen the file - I then can't set the COM port - but it 'remembers' the previous setting (COM7 here)!

I used a new programmer file (AVR_Diamex) - though it should be possible to use one of the standard files (with stk500v2 as the programmer type in this case) - but I didn't want to mess up my set up whilst fiddling.

The ATTiny4313 fcdx file only seems to define one fuse value - although BOD (brown out detection) and other options are available too in hfuse?

'Download config now' can be used to change the clock (from 20MHz ext to 1MHz (8 + div) internal and works well - I use a simple blinkie and a 'scope to test.

I didn't manage to turn off / get to work the autodetect - so the user must untick the box before selecting the COM port.

Although the MCU has a hardware UART - (and the component allows channel 1) - compiling gives:
C:\ProgramData\MatrixTSL\FlowcodeV11\CAL\AVR\AVR_CAL_UART.c: In function
'FC_CAL_UART_Send_1':
C:\ProgramData\MatrixTSL\FlowcodeV11\CAL\AVR\AVR_CAL_UART.c:1236:11: error: lvalue required as left operand of assignment
UDR0 = nChar;
^
Possibly should just be UDR, although the CAL file seems to do #define UDR0 UDR? Software mode is okay though.

Martin
Attachments
avr_diamex.zip
(1.3 KiB) Downloaded 11 times
ATTINY4313_dev_board.zip
(2.93 KiB) Downloaded 12 times

LeighM
Valued Contributor
Posts: 548
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 102 times
Been thanked: 300 times

Re: ATTiny2313/4313 Flowcode development board

Post by LeighM »

Quick look on my mobile, re the first issue, I think you need to change device name="ATTINY4313' to something like ATTINY4313_dev_board to make the fcd unique. As I recall, as an alternative, there's also a 'file' option property for the device section.
Hope that helps.

mnfisher
Valued Contributor
Posts: 2018
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 159 times
Been thanked: 945 times

Re: ATTiny2313/4313 Flowcode development board

Post by mnfisher »

Thanks Leigh,

I'll have another play - my first attempt stopped compilation with configuration file not found (or words to that effect) - presumably compilation uses chip:l and changing this to the alternate name should fix the issue?

Martin

Post Reply