Jose  
                
               
                 
              
                  
                    November 11, 2021,  1:35pm
                   
                   
              1 
               
             
            
              Hi all, I am using a Digital Thermometer (https://datasheets.maximintegrated.com/en/ds/MAX31723PMB1.pdf ), which works by SPI in PMOD in the PYNQ-Z2.
I have written a code that is a kind of translation from a C code, but it always returns -1. It is as if it does not connect to the PMOD or something else is missing to make it work well. I have not found any example of SPI by PMOD to guide me.
Has anyone worked with any PMOD over SPI module on the PYNQ-Z2?, could you tell me what might be wrong or what I am missing?.
The code is as follows:
 SPI 
 PMOD B 
Connector Sup. Pmod B
lib_spi = MicroblazeLibrary(base.PMODB, [‘spi’]) 
lib_spi.spi_configure(spi, 1, 1) 
spi = lib_spi.spi_open(3, 2, 1, 0)
length = 3 
read_data = [0x01, 0x00, 0x00]
#spi .transfer(“NULL”, [0x01, 0x00], length) 
spi.transfer(“NULL”, read_data, length)
print(read_data)
spi.close()
Thanks a lot!!!
             
            
               
               
              1 Like 
            
            
           
          
            
              
                naveen  
                
               
              
                  
                    November 17, 2021, 11:19pm
                   
                   
              2 
               
             
            
              Hi,
PMOD OLED uses SPI protocol. You can take a look at it:
  
  
    
      /******************************************************************************
 *  Copyright (c) 2016, Xilinx, Inc.
 *  All rights reserved.
 * 
 *  Redistribution and use in source and binary forms, with or without 
 *  modification, are permitted provided that the following conditions are met:
 *
 *  1.  Redistributions of source code must retain the above copyright notice, 
 *     this list of conditions and the following disclaimer.
 *
 *  2.  Redistributions in binary form must reproduce the above copyright 
 *      notice, this list of conditions and the following disclaimer in the 
 *      documentation and/or other materials provided with the distribution.
 *
 *  3.  Neither the name of the copyright holder nor the names of its 
 *      contributors may be used to endorse or promote products derived from 
 *      this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
 
  This file has been truncated. show original 
   
  
    
    
  
  
 
  
  
    
      {
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Displaying text on a PmodOLED\n",
    "\n",
    "This demonstration shows how to display text on a PmodOLED using the board.\n",
    "\n",
    "The Digilent Pmod OLED is required. In this example it should be connected to PMODA."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
 
  This file has been truncated. show original 
   
  
    
    
  
  
 
Thanks
             
            
               
               
              2 Likes