News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

28 pin SSOP Development board

Started by JonW, Oct 05, 2021, 04:45 PM

Previous topic - Next topic

JonW

I have design a development board for 28 pin parts, I've been meaning to do one for a while that is small and easy to port out quiclky

Features:

Mini USB Connector
28 Pin PIC's in SSOP
CP2102 USB IC
ESD protection on USB
RTS pulldown to MCLR via FET/ Diode protected on pull-up if MCLR used
2 LED
PICKIT ICSP

Only getting 50 off first run but have omitted the MCU but am thinking of fitting the 18F26k42 rather than the popular 26k22, any thoughts?

Will sell some in UK if there is any interest

PCB 20mm x 35mm with 2.54mm headers

Jon


atomix

I would be interested in a board with PIC18F16Q41 for future study

John Lawton


atomix


top204

That Microchip board and other like it, that are made in China are one of the reasons I had to drop the Positron board idea, because I could never match those prices and I would have made, perhaps, £1 per board. And with it being a niche market, I maybe would have earned £50 or so, total, for months of work on the hardware, software and documentation. Simply not worth it, and I have no income to make it as a hobby.

The Microchip board looks interesting and I'll see if I can afford one. The new Q devices are what I am currently working on with the upgrade of the Positron8 compiler. They are the same as the previous, supported, Q devices, but have up to 13K of RAM.


JonW

#5
Pm or mail me your address and I will  send you some to develop on.  If you let me know what device you want on it then I populate the MCU.  Should  arrive in a couple of weeks.  The microchip curiosity boards seem to have a their own USB device which I never use anyway so this has the UART ported out

Jon

JonW


tumbleweed

The Curiosity Nano boards have more than just their own USB device... they include a built-in Pickit4 compatible debugger/programmer as well.

Just fyi - the Q40/Q41 are 14/20-pin parts, so they're not compatible with a 28-pin dev board.

JonW

#8
Yeah I am familiar with them and have a few but if you want a simple Uart function or to include a bootloader and I/O's powered from the serial port they are not that good and some of the devices not supported (yet).  Yeah they are suberb for the money

RGV250

Hi Les,
Just a thought, if you have any of the Positron boards why not put them up for sale here. I am sure there would be some takers which would hopefully recover at least some of what you spent on development.

Regards,
Bob

atomix

#10
Les i sent you the required amount through the paypal to buy this board.

 PIC18F16Q41 - has two 8-bit DACs  and 32-Bit CRC

TimB


I just want to buy a positron board. Not worried about the cost.

Yasin

#12
If it does not make sense to produce because of the production cost, you can share it as a project. I have no idea how much income it can generate. But I have a suggestion. PCBway has an implementation. Users share a project on the site as open source. When other users like and order this project, the owner of the project gets commission from it. Costs such as supply of parts, assembly cost, shipping costs are eliminated. Probably a very low commission. But it looks like it has a chance to win from the release. There may even be an indirect advertisement of the Positron compiler on this platform. Dear @Les, if you have a finished work and you have stopped producing it commercially, you can try to monetize the work.


https://www.pcbway.com/project/shareproject

JonW

#13
The reason I developed it was to promote the compiler and create a discussion, not to make profit or for personal gain, hence the reason it was posted here first. As a community we have the skills in this forum to keep this product alive and advance it to new levels.  Its purpose was to be a very simple board, at low cost that could be used to promote sales and get more funding to help the development of the compiler  using the most popular devices.   The major issue  with the compiler (IMHO) is marketing and if you all follow kickstarter type projects you can easily see that it can be used as a tool to create funding and grow.


Take a look at this https://www.kickstarter.com/projects/udoo/udoo-key-the-4-ai-platform?utm_source=exclusive&utm_medium=org&ref=exclusive-org

Well marketed and not very useful for most yet gets exposure fast and generates revenue.

BTW the boards are generated and stuffed in China and the cost is around £4 delivered DDP to UK without a Pic in Qty 50.  With a PIC that puts it around £5.50/50 depending on the processor.  Scale it to say 50k and its likely to be around $2.50 (depending on the MCU and working in USD).   WAY less than Nano boards and could easily be developed with a good bootlloader that could potentially be used commercially.  Plenty of profit to be made on a simple board alone....

Without funding, USC, or internal sales the compiler and all its efforts WILL fade. 

J





JonW


top204

#15
I just wish I had your business head Jon.

The board looks good, and hopefully, will encourage people to purchase the compilers. I can't see any voltage regulation on it for 5V and 3V operation or a voltage in that is not 5V or 3.3V. This could be important because the vast majority of peripheral devices are now 3.3V operating, but all the, outdated, Arduino peripheral boards are 5V operating with voltage conversion components on them, but they are very inexpensive to purchase.

Do you have a bootloader for it? I created PIC18F27K42 bootloader firmware for the Tiny+ Bootloader, in Positron8 BASIC code, and it is on the tiny bootloader's forum site. A few simple changes to the flash memory settings will make it work for the PIC18F26K42 device as well.

Please try to make the documentation for the board clear and interesting, because this will encourage people to purchase it when they download the documentation to see what the board can do before purchase etc...

I'm now trying to get my head around the dsPIC33CK method of flash memory programming, because, as usual, it has been changed yet again by Microchip, for no reason whatsoever!

top204

#16
Many thanks Atomix. The forum has been a lifeline for me since my injury, and it is always good to know that there are people out there who actually "give a damn" and care. :-)

I am currently working on the optimiser for the new compiler versions that support the newer Q devices, and it is coming along nicely, when I get the time to get into the code. I could release it without the optimiser, but that is not my way, and it has to be able to produce good, optimised, compact and fast code, otherwise, the compiler will be no better than the other compilers out there. i.e. Sloppy assembler code. :-)

JonW

Hi Les
Always here to help out.

Regulation is provided by the CP2102 internal 3V3, it has a modest 100mA rated LDO to keep the cost and space down. It was intended to be powered from USB all the time and no external VCC.  A poly fuse and a diode could be added to future revisions once its running and port it to a 20 pin part too.

I will take a look at the bootloader, did you post the basic file?  If not please PM it or post it.  I may do a simple Gui where you can drag and drop the hex file like the Nano boards and a simple configurable terminal like the one i did many years ago (Serial Debug).

J

top204

The PIC18F27K42 bootloader firmware is listed below. It uses the device's internal oscillator, multiplied up to 64MHz and operates with a Baud rate of 57600, but this can easily be changed in the code.

'
'   /\\\\\\\\\
'  /\\\///////\\\
'  \/\\\     \/\\\                                                 /\\\          /\\\
'   \/\\\\\\\\\\\/        /\\\\\     /\\\\\\\\\\     /\\\\\\\\   /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
'    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
'     \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\     \/\\\         \/\\\        /\\\\\\\\\\
'      \/\\\     \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\     \/\\\ /\\   /\\\/////\\\
'       \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\   \//\\\\\\\\/\\
'        \///        \///     \/////     \//////////    \//////////      \/////        \/////     \////////\//
'                                  Let's find out together what makes a PIC Tick!
'
' PIC18F27K42 bootloader firmware for use with the Tiny Bootloader+ PC app.
' Written in Positron8 BASIC mixed with Asm mnemonics to have extra control of RAM bank switching.
' It makes the code look a lot more complex, but saves a few bytes of flash memory so the bootloader takes up less room.
'
    Device = 18F27K42
    Declare Xtal = 64
    Declare Access_Upper_64K = True                 ' Set to true because the 18F27K42 device has 128K of flash memory
    Declare Library_Core = Off                      ' Disable the compiler's library code creation
'
' Setup some constants to determine the bootloader's operation
'
$define cIdTypePIC $6F                              ' The device code for the PC app. This must exists in "piccodes.ini"
$define cMax_Flash _code                            ' In Words, not bytes!!! (= 'max flash memory' from "piccodes.ini" divided by 2)
$define cWriteBlockSize 64                          ' Size of the Code Memory Write Segment (in Words)
$define cEraseBlock_Size 64                         ' Size of the Code Memory Erase Segment (in Words)

$define cXtal $eval (_xtal * 1000000)               ' The oscillator value (in MHz)
$define cBaud 57600                                 ' Set the Baud rate required for the bootloader

$define cBootloader_Address $eval (cMax_Flash - ((cWriteBlockSize * 4) + 8))  ' 264 bytes, 132 words
'
' Setup the Baud Rate
'
Asm-
cRoundResult = 0
mRound Macro pParam1, pParam2
Local cTemp = pParam1 / pParam2
Local cD1 = pParam1 - cTemp * pParam2
Local cD2 = (cTemp + 1) * pParam2 - pParam1
cRoundResult = cTemp
    If cD1 >= cD2
        cRoundResult++
    EndIf
Endm

cAbsResult = 0
mAbs Macro pNr
    If pNr >= 0
        cAbsResult = pNr
    Else
        cAbsResult = -pNr
    EndIf
Endm

    mRound cXtal, (16 * cBaud)
SPBRG_Value = cRoundResult - 1

    mRound cXtal, (16 * (SPBRG_Value + 1))
cBaud_Real = cRoundResult
    mAbs(cBaud_Real - cBaud)
cErrPercent = cAbsResult * 100 / cBaud
    If cErrPercent > 4
        Error Error in Baudrate: #v(cErrPercent)%
    EndIf
EndAsm
'
' Create variables for the bootloader
'
    Dim bWriteBuffer[14] As Byte                    ' Buffer used for holding data
    Dim bCRC             As Byte                    ' Holds the CRC value
    Dim bByteCount       As Byte                    ' Holds the amount of bytes for a block flash write
    Dim bFlags           As Byte                    ' Holds the requirement of which memory area to write
    Dim tEepromWrite     As bFlags.6                ' Set if EEPROM is to be written
    Dim tConfigWrite     As bFlags.7                ' Set if config memory is to be written

    Dim bTimeoutCounter1 As Byte                    ' \
    Dim bTimeoutCounter2 As Byte                    ' | Timeout counter for receiving a byte
    Dim bTimeoutCounter3 As Byte                    ' /

    Dim wFSR0 As FSR0L.Word                         ' Convert 8-bit SFRs FSR0L\H into a 16-bit SFR
    Dim wFSR1 As FSR1L.Word                         ' Convert 8-bit SFRs FSR1L\H into a 16-bit SFR
'
' Bit mask values for the NVMCONx SFRs
'
$define cREG0 $eval (1 << 6)
$define cREG1 $eval (1 << 7)
$define cWREN $eval (1 << 2)
$define cFREE $eval (1 << 4)
'
' Bit mask values for the U1CON0 SFR
'
$define cRXEN $eval (1 << 4)
$define cTXEN $eval (1 << 5)

$ifndef False
    $define False 0
$endif
$ifndef True
    $define True 1
$endif
'------------------------------------------------------------------------------------------------------------------------
' Reset

    Org 0
    GoTo BootloaderStart

    Org cBootloader_Address                 ' Space to place the first 4 instructions of the user program
    Nop
    Nop
    Nop
    Nop

    Org cBootloader_Address + 8
BootloaderStart:
    Clear FSR0H                             ' Make sure FSR0H is actually clear before we start
'
' Setup USART1 for serial coms
'
    wFSR1 = AddressOf(U1TXB)                ' FSR1L\H now holds the address of SFR U1TXB
    Movlb (PPSLOCK >> 8)                    ' PPS RAM Bank
    GoSub PPS_Setup                         ' \ Unlock PPS
    Bcf PPSLOCKbits_PPSLOCKED               ' /

    WREG = PPS_Fn_TX1                       ' \ Set TX PPS pin
    Movwf RC6PPS                            ' /
    WREG = Pin_C7                           ' \ Set RX PPS pin
    Movwf U1RXPPS                           ' /

    GoSub PPS_Setup                         ' \ Lock PPS
    Bsf PPSLOCKbits_PPSLOCKED               ' /
    Clrf ANSELC                             ' Set PORTC to digital

    Movlb (U1CON0 >> 8)                     ' USART RAM Bank
    WREG = (cTXEN | cRXEN)                  ' BRGS = 0, ABDEN = 0, cTXEN = 1, cRXEN = 1. MODE = 0
    Movwf U1CON0                            ' Set U1CON0
    Movlw (SPBRG_Value)                     ' \
    Movwf U1BRGL                            ' / Load U1BRGL
    Bsf U1CON1bits_U1ON                     ' Set U1CON1
'
' Wait for the computer
'
    Movlb (NVMCON1 >> 8)                    ' NVM/PIR RAM Bank
    GoSub ReceiveByteInto_WREG              ' Receive the initialisation byte from the computer
    WREG = $C1 - WREG                       ' Expect $C1
    Bnz Exit_Bootloader
    INDF1 = cIdTypePIC                      ' Send the PIC type to the PC application

MainLoop:
    WREG = "C"                              ' Ready and waiting for data
ContinueLoop:
    INDF1 = WREG
    Clear bCRC
    GoSub ReceiveByteInto_WREG              ' Receive the Upper address value
    TBLPTRU = WREG                          ' For Flash memory
    bFlags = WREG                           ' Load the flags with certain bits from the upper address value received
    GoSub ReceiveByteInto_WREG              ' Receive the High address value
    TBLPTRH = WREG                          ' For Flash memory
    Movwf NVMADRH                           ' For EEPROM
    GoSub ReceiveByteInto_WREG              ' Receive the Low address value
    TBLPTRL = WREG                          ' For Flash memory
    Movwf NVMADRL                           ' For EEPROM

    GoSub ReceiveByteInto_WREG              ' Receive the amount of bytes
    bByteCount = WREG

    Clear FSR0L                             ' FSR0L\H = The address of the start of the RAM Buffer
    Tblrd*-                                 ' Read flash memory into TABLAT and auto decrement the address in TBLPTRL\H\U
Receive_Byte:
    GoSub ReceiveByteInto_WREG              ' Receive a data byte
    If tConfigWrite = True Then             ' For Config?
        POSTINC0 = WREG                     ' Yes so load INDF0 with the byte and auto increment FSR0L\H
    EndIf
    Movwf NVMDAT                            ' For EEPROM
    TABLAT = WREG                           ' For Program Flash Memory
    Tblwt+*                                 ' Write flash memory from TABLAT and auto increment the address in TBLPTRL\H\U
    Djnz bByteCount, Receive_Byte           ' Decrement the byte count loop until it reaches zero

    GoSub ReceiveByteInto_WREG              ' Receive the CRC value
CRC_Check:                                  ' CRC check
    WREG = "N"
    Bnz ContinueLoop

    If tConfigWrite = False Then            ' Is it a Config write?
        WREG = cWREN                        ' No. So setup for EEPROM
        If tEepromWrite = False Then        ' Is it an EEPROM write?
            GoSub SetupEraseBlock           ' No. So erase the flash memory block first
        EndIf
        GoSub SetupWriteByte
        Bra MainLoop
    EndIf
'
' Setup WriteByte Config
'
Write_Config:
    Dec FSR0L
    WREG = INDF0                            ' Set TABLAT
    TABLAT = WREG
    WREG = (cREG0 | cWREN)                  ' Setup for config
    GoSub SetupWriteByte
    Tblrd*-                                 ' Read flash memory into TABLAT and auto decrement the address in TBLPTRL\H\U
    Tstfsz FSR0L                            ' FSR0L = 0?
    Bra Write_Config                        ' No so jump back
    Bra MainLoop
'
' Subroutines
'
' Setup to unlock or lock PPS
'
PPS_Setup:
    WREG = $55
    Movwf PPSLOCK
    WREG = $AA
    Movwf PPSLOCK
    Return
'
' Setup to erase or write memory
'
SetupEraseBlock:
    WREG = (cREG1 | cFREE | cWREN)          ' Setup for erase
SetupWriteByte:
    Movwf NVMCON1
    WREG = $55
    Movwf NVMCON2
    WREG = $AA
    Movwf NVMCON2
    Bsf NVMCON1bits_WR
    Retlw (cREG1 | cWREN)                   ' Setup for Program Flash Memory
'
' Receive a byte from USART1 into WREG, with a timeout
'
ReceiveByteInto_WREG:
    bTimeoutCounter1 = ((cXtal / 2000000) + 1)  ' Setup the USART1 timout time
    Clrwdt
Repeat3:
    Clear bTimeoutCounter2
Repeat2:
    Clear bTimeoutCounter3
RepeatInner:
    Btfss PIR3bits_U1RXIF                   ' Has a byte been received?
    Bra NotReceivedYet                      ' No. So jump to the timeout counting loop
@   Subfsr 1,(U1TXB - U1RXB)                ' FSR1L\H now holds the address of U1RXB
    WREG = INDF1                            ' Return read data in WREG
@   Addfsr 1,(U1TXB - U1RXB)                ' FSR1L\H now holds the address of U1TXB
    bCRC = bCRC + WREG                      ' Compute the CRC
    Return

NotReceivedYet:
    Djnz bTimeoutCounter3, RepeatInner
    Djnz bTimeoutCounter2, Repeat2
    Djnz bTimeoutCounter1, Repeat3
                                            ' Timeout
Exit_Bootloader:
    Clear NVMCON1
    Clear U1CON1bits_U1ON                   ' Disable UART1
    Reset_Bank                              ' Point back to RAM Bank0
    Bra cBootloader_Address

'-------------------------------------------------------------------------------------
' Configure the device to operate from its internal oscillator at 64MHz
'
Config_Start
    FEXTOSC = Off                       ' External oscillator not enabled
    RSTOSC = HFINTOSC_64MHZ             ' HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1
    CLKOUTEN = Off                      ' CLKOUT function is disabled
    PR1WAY = Off                        ' PRLOCK bit can be set and cleared repeatedly
    CSWEN = On                          ' The NOSC and NDIV bits can be changed by user software
    FCMEN = Off                         ' Fail-Safe Clock Monitor disabled
    MCLRE = EXTMCLR                     ' If LVP = 0, MCLR pin is MCLR. If LVP = 1, RE3 pin function is MCLR
    PWRTS = PWRT_16                     ' PWRT set at 16ms
    MVECEN = Off                        ' Interrupt contoller does not use vector table to prioritise interrupts
    IVT1WAY = Off                       ' IVTLOCK bit can be cleared and set repeatedly
    LPBOREN = Off                       ' ULPBOR disabled
    BOREN = Off                         ' Brown-out Reset disabled
    BORV = VBOR_2P85                    ' Brown-out Reset Voltage (VBOR) set to 2.8V
    ZCD = Off                           ' ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON
    PPS1WAY = Off                       ' PPSLOCK bit can be set and cleared repeatedly
    STVREN = On                         ' Stack full/underflow will cause Reset
    Debug = Off                         ' Background debugger disabled
    XINST = Off                         ' Extended Instruction disabled
    WDTCPS = WDTCPS_2                   ' Divider ratio 1:128
    WDTE = SWDTEN                       ' WDT enabled/disabled by SWDTEN bit
    WDTCWS = WDTCWS_7                   ' Window always open (100%). Software control. Keyed access not required
    WDTCCS = SC                         ' WDT input clock selector is Software Control
    BBSIZE = BBSIZE_512                 ' Boot Block size is 512 words
    BBEN = Off                          ' Boot block disabled
    SAFEN = Off                         ' Storage Area Flash disabled
    WRTAPP = Off                        ' Application Block not write protected
    WRTB = Off                          ' Configuration registers (300000-30000Bh) not write-protected
    WRTC = Off                          ' Boot Block (000000-0007FFh) not write-protected
    WRTD = Off                          ' EEPROM not write-protected
    WRTSAF = Off                        ' SAF not Write Protected
    LVP = Off                           ' HV on MCLR/VPP must be used for programming
    Cp = Off                            ' PFM and EEPROM code protection disabled
Config_End

towlerg

Very cool Les, but as usual whatever you do for peeps they (me actually) want more. I'm unclear where tiny bootloader code comes in.